mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibWeb: Implement the "insertHTML" editing command
This commit is contained in:
committed by
Andreas Kling
parent
cb05ab6515
commit
20fb7b1a49
Notes:
github-actions[bot]
2025-01-10 22:35:30 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/20fb7b1a496 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
18
Tests/LibWeb/Text/input/Editing/execCommand-insertHTML.html
Normal file
18
Tests/LibWeb/Text/input/Editing/execCommand-insertHTML.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<script src="../include.js"></script>
|
||||
<div contenteditable="true">foobar</div>
|
||||
<script>
|
||||
test(() => {
|
||||
var divElm = document.querySelector('div');
|
||||
|
||||
// Put cursor between 'foo' and 'bar'
|
||||
var range = document.createRange();
|
||||
getSelection().addRange(range);
|
||||
range.setStart(divElm.childNodes[0], 3);
|
||||
range.setEnd(divElm.childNodes[0], 3);
|
||||
|
||||
// Insert HTML
|
||||
document.execCommand('insertHTML', false, '<em>Ladybird</em>');
|
||||
|
||||
println(divElm.innerHTML);
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user