mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibWeb: Implement the "insertOrderedList" editing command
This commit is contained in:
parent
01ce9cb151
commit
199eaf0d3e
Notes:
github-actions[bot]
2025-01-10 22:35:15 +00:00
Author: https://github.com/gmta
Commit: 199eaf0d3e
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
6 changed files with 479 additions and 0 deletions
|
@ -0,0 +1,31 @@
|
|||
<script src="../include.js"></script>
|
||||
<div contenteditable="true" id="d1">foobar</div>
|
||||
<div contenteditable="true" id="d2"><ol><li>foobar</li></ol></div>
|
||||
<div contenteditable="true" id="d3"><ul><li>foobar</li></ul></div>
|
||||
<script>
|
||||
test(() => {
|
||||
const range = document.createRange();
|
||||
getSelection().addRange(range);
|
||||
|
||||
// Create ordered list of 'foobar'
|
||||
const div1 = document.querySelector('#d1');
|
||||
range.setStart(div1.firstChild, 0);
|
||||
range.setEnd(div1.firstChild, 6);
|
||||
document.execCommand('insertOrderedList');
|
||||
println(div1.innerHTML);
|
||||
|
||||
// De-ordered list 'foobar'
|
||||
const div2 = document.querySelector('#d2');
|
||||
range.setStart(div2.firstChild.firstChild.firstChild, 0);
|
||||
range.setEnd(div2.firstChild.firstChild.firstChild, 6);
|
||||
document.execCommand('insertOrderedList');
|
||||
println(div2.innerHTML);
|
||||
|
||||
// Change type of list
|
||||
const div3 = document.querySelector('#d3');
|
||||
range.setStart(div3.firstChild.firstChild.firstChild, 0);
|
||||
range.setEnd(div3.firstChild.firstChild.firstChild, 6);
|
||||
document.execCommand('insertOrderedList');
|
||||
println(div3.innerHTML);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue