mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 10:41:30 +00:00
LibWeb: Implement the "forwardDelete" editing command
This commit is contained in:
parent
a71e999ac8
commit
7736d63290
Notes:
github-actions[bot]
2025-01-10 22:37:23 +00:00
Author: https://github.com/gmta
Commit: 7736d63290
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
4 changed files with 218 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
<script src="../include.js"></script>
|
||||
<div contenteditable="true">foobar</div>
|
||||
<script>
|
||||
test(() => {
|
||||
var divElm = document.querySelector('div');
|
||||
println(`Before: ${divElm.textContent}`);
|
||||
|
||||
// Put cursor after 'foo'
|
||||
var range = document.createRange();
|
||||
range.setStart(divElm.childNodes[0], 3);
|
||||
getSelection().addRange(range);
|
||||
|
||||
// Press delete
|
||||
document.execCommand('forwardDelete');
|
||||
|
||||
println(`After: ${divElm.textContent}`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue