Truly independent web browser
LibWeb: Remove empty inline elements before adding a placeholder br
Andreas Kling609aa73c3b53
diff --git a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp b/Libraries/LibWeb/Editing/Internal/Algorithms.cppindex 210d06cb7e7..38c5bb5b018 100644--- a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp+++ b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp@@ -1368,22 +1368,37 @@ void delete_the_selection(Selection& selection, bool block_merging, bool strip_w// 2. Remove node from parent.remove_node(*node);+ // INTEROP: Browsers remove the inline elements that the deletion leaves empty before they add a line break to+ // an empty block, so that the line break is not inside them. The overrides keep their formatting for+ // the text that is inserted next. So if the block node of parent has no visible children, do step 4+ // before step 3 as well.+ auto strip_empty_wrappers = [&] {+ // 4. If strip wrappers is true or parent is not an inclusive ancestor of start node, while parent is an+ // editable inline node with length 0, let grandparent be the parent of parent, then remove parent from+ // grandparent, then set parent to grandparent.+ if (strip_wrappers || !parent->is_inclusive_ancestor_of(start.node)) {+ while (parent->parent() && parent->is_editable() && is_inline_node(*parent) && parent->length() == 0) {+ auto grandparent = parent->parent();+ remove_node(*parent);+ parent = grandparent;+ }+ }+ };+ // NB: Keep a font element, and put the line break in it as the spec does. The overrides would create a new+ // font element for the text that is inserted next, but with the resolved values instead of the attributes+ // of the old one, such as color="#0000ff" instead of color="blue". The editing tests expect the old font+ // element to be kept, for example when typing after deleting all of <font color=blue>[foo]</font>.+ auto block_node_of_parent = block_node_of_node(*parent);+ if (block_node_of_parent && !has_visible_children(*block_node_of_parent) && !is<HTML::HTMLFontElement>(*parent))+ strip_empty_wrappers();+// 3. If the block node of parent has no visible children, and parent is editable or an editing host, call// createElement("br") on the context object and append the result as the last child of parent.- auto block_node_of_parent = block_node_of_node(*parent);+ block_node_of_parent = block_node_of_node(*parent);if (block_node_of_parent && !has_visible_children(*block_node_of_parent) && parent->is_editable_or_editing_host())MUST(append_node(MUST(DOM::create_element(document, HTML::TagNames::br, Namespace::HTML)), *parent));- // 4. If strip wrappers is true or parent is not an inclusive ancestor of start node, while parent is an- // editable inline node with length 0, let grandparent be the parent of parent, then remove parent from- // grandparent, then set parent to grandparent.- if (strip_wrappers || !parent->is_inclusive_ancestor_of(start.node)) {- while (parent->parent() && parent->is_editable() && is_inline_node(*parent) && parent->length() == 0) {- auto grandparent = parent->parent();- remove_node(*parent);- parent = grandparent;- }- }+ strip_empty_wrappers();}// 26. If end node is an editable Text node, call deleteData(0, end offset) on it.diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]index 453466e7c0d..e5156564e31 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]@@ -2,8 +2,8 @@ Harness status: OKFound 1000 tests-979 Pass-21 Fail+989 Pass+11 FailPass [["defaultparagraphseparator","div"],["delete",""]] "<p>foo<ol><li>bar<li>ba[z</ol><p>q]uz" queryCommandState("delete") beforePass [["defaultparagraphseparator","div"],["delete",""]] "<p>foo<ol><li>bar<li>ba[z</ol><p>q]uz" queryCommandValue("delete") beforePass [["defaultparagraphseparator","div"],["delete",""]] "<p>foo<ol><li>bar<li>ba[z</ol><p>q]uz" queryCommandIndeterm("delete") after@@ -685,7 +685,7 @@ Pass [["defaultparagraphseparator","p"],["delete",""]] "<ul><li>foo</ul><p>{}<brPass [["defaultparagraphseparator","p"],["delete",""]] "<ul><li>foo</ul><p>{}<br></p><ol><li>bar</ol>" queryCommandValue("delete") afterPass [["delete",""]] "<p><b>[foo]</b>": execCommand("delete", false, "") return valuePass [["delete",""]] "<p><b>[foo]</b>" checks for modifications to non-editable content-Fail [["delete",""]] "<p><b>[foo]</b>" compare innerHTML+Pass [["delete",""]] "<p><b>[foo]</b>" compare innerHTMLPass [["delete",""]] "<p><b>[foo]</b>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<p><b>[foo]</b>" queryCommandState("delete") beforePass [["delete",""]] "<p><b>[foo]</b>" queryCommandValue("delete") before@@ -694,7 +694,7 @@ Pass [["delete",""]] "<p><b>[foo]</b>" queryCommandState("delete") afterPass [["delete",""]] "<p><b>[foo]</b>" queryCommandValue("delete") afterPass [["delete",""]] "<p><quasit>[foo]</quasit>": execCommand("delete", false, "") return valuePass [["delete",""]] "<p><quasit>[foo]</quasit>" checks for modifications to non-editable content-Fail [["delete",""]] "<p><quasit>[foo]</quasit>" compare innerHTML+Pass [["delete",""]] "<p><quasit>[foo]</quasit>" compare innerHTMLPass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandState("delete") beforePass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandValue("delete") before@@ -703,7 +703,7 @@ Pass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandState("delete") aftPass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandValue("delete") afterPass [["delete",""]] "<p><b><i>[foo]</i></b>": execCommand("delete", false, "") return valuePass [["delete",""]] "<p><b><i>[foo]</i></b>" checks for modifications to non-editable content-Fail [["delete",""]] "<p><b><i>[foo]</i></b>" compare innerHTML+Pass [["delete",""]] "<p><b><i>[foo]</i></b>" compare innerHTMLPass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandState("delete") beforePass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandValue("delete") before@@ -712,7 +712,7 @@ Pass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandState("delete") afterPass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandValue("delete") afterPass [["delete",""]] "<p><b>{foo}</b>": execCommand("delete", false, "") return valuePass [["delete",""]] "<p><b>{foo}</b>" checks for modifications to non-editable content-Fail [["delete",""]] "<p><b>{foo}</b>" compare innerHTML+Pass [["delete",""]] "<p><b>{foo}</b>" compare innerHTMLPass [["delete",""]] "<p><b>{foo}</b>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<p><b>{foo}</b>" queryCommandState("delete") beforePass [["delete",""]] "<p><b>{foo}</b>" queryCommandValue("delete") before@@ -721,7 +721,7 @@ Pass [["delete",""]] "<p><b>{foo}</b>" queryCommandState("delete") afterPass [["delete",""]] "<p><b>{foo}</b>" queryCommandValue("delete") afterPass [["delete",""]] "<p>{<b>foo</b>}": execCommand("delete", false, "") return valuePass [["delete",""]] "<p>{<b>foo</b>}" checks for modifications to non-editable content-Fail [["delete",""]] "<p>{<b>foo</b>}" compare innerHTML+Pass [["delete",""]] "<p>{<b>foo</b>}" compare innerHTMLPass [["delete",""]] "<p>{<b>foo</b>}" queryCommandIndeterm("delete") beforePass [["delete",""]] "<p>{<b>foo</b>}" queryCommandState("delete") beforePass [["delete",""]] "<p>{<b>foo</b>}" queryCommandValue("delete") before@@ -730,7 +730,7 @@ Pass [["delete",""]] "<p>{<b>foo</b>}" queryCommandState("delete") afterPass [["delete",""]] "<p>{<b>foo</b>}" queryCommandValue("delete") afterPass [["delete",""]] "<p><b>f[]</b>": execCommand("delete", false, "") return valuePass [["delete",""]] "<p><b>f[]</b>" checks for modifications to non-editable content-Fail [["delete",""]] "<p><b>f[]</b>" compare innerHTML+Pass [["delete",""]] "<p><b>f[]</b>" compare innerHTMLPass [["delete",""]] "<p><b>f[]</b>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<p><b>f[]</b>" queryCommandState("delete") beforePass [["delete",""]] "<p><b>f[]</b>" queryCommandValue("delete") before@@ -739,7 +739,7 @@ Pass [["delete",""]] "<p><b>f[]</b>" queryCommandState("delete") afterPass [["delete",""]] "<p><b>f[]</b>" queryCommandValue("delete") afterPass [["delete",""]] "<b>[foo]</b>": execCommand("delete", false, "") return valuePass [["delete",""]] "<b>[foo]</b>" checks for modifications to non-editable content-Fail [["delete",""]] "<b>[foo]</b>" compare innerHTML+Pass [["delete",""]] "<b>[foo]</b>" compare innerHTMLPass [["delete",""]] "<b>[foo]</b>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<b>[foo]</b>" queryCommandState("delete") beforePass [["delete",""]] "<b>[foo]</b>" queryCommandValue("delete") before@@ -748,7 +748,7 @@ Pass [["delete",""]] "<b>[foo]</b>" queryCommandState("delete") afterPass [["delete",""]] "<b>[foo]</b>" queryCommandValue("delete") afterPass [["delete",""]] "<div><b>[foo]</b></div>": execCommand("delete", false, "") return valuePass [["delete",""]] "<div><b>[foo]</b></div>" checks for modifications to non-editable content-Fail [["delete",""]] "<div><b>[foo]</b></div>" compare innerHTML+Pass [["delete",""]] "<div><b>[foo]</b></div>" compare innerHTMLPass [["delete",""]] "<div><b>[foo]</b></div>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<div><b>[foo]</b></div>" queryCommandState("delete") beforePass [["delete",""]] "<div><b>[foo]</b></div>" queryCommandValue("delete") before@@ -964,7 +964,7 @@ Pass [["delete",""]] "foo<span>bar<span contenteditable=false>baz</span></span>[Pass [["delete",""]] "foo<span>bar<span contenteditable=false>baz</span></span>[]qux" queryCommandValue("delete") afterPass [["delete",""]] "<span>[abc]</span>": execCommand("delete", false, "") return valuePass [["delete",""]] "<span>[abc]</span>" checks for modifications to non-editable content-Fail [["delete",""]] "<span>[abc]</span>" compare innerHTML+Pass [["delete",""]] "<span>[abc]</span>" compare innerHTMLPass [["delete",""]] "<span>[abc]</span>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<span>[abc]</span>" queryCommandState("delete") beforePass [["delete",""]] "<span>[abc]</span>" queryCommandValue("delete") before@@ -982,7 +982,7 @@ Pass [["delete",""]] "<span>[abc]</span><br>" queryCommandState("delete") afterPass [["delete",""]] "<span>[abc]</span><br>" queryCommandValue("delete") afterPass [["delete",""]] "<p><span>[abc]</span></p>": execCommand("delete", false, "") return valuePass [["delete",""]] "<p><span>[abc]</span></p>" checks for modifications to non-editable content-Fail [["delete",""]] "<p><span>[abc]</span></p>" compare innerHTML+Pass [["delete",""]] "<p><span>[abc]</span></p>" compare innerHTMLPass [["delete",""]] "<p><span>[abc]</span></p>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<p><span>[abc]</span></p>" queryCommandState("delete") beforePass [["delete",""]] "<p><span>[abc]</span></p>" queryCommandValue("delete") beforediff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]index 7610b4bc933..fbeea56ad10 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]@@ -2,8 +2,8 @@ Harness status: OKFound 842 tests-806 Pass-36 Fail+811 Pass+31 FailPass [["delete",""]] "<p contenteditable=false><span contenteditable=true>[abc]</span></p>" queryCommandIndeterm("delete") afterPass [["delete",""]] "<p contenteditable=false><span contenteditable=true>[abc]</span></p>" queryCommandState("delete") afterPass [["delete",""]] "<p contenteditable=false><span contenteditable=true>[abc]</span></p>" queryCommandValue("delete") after@@ -252,7 +252,7 @@ Pass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditPass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>[ab</b></p><p><i>c]d</i></p></custom-element></div>" queryCommandValue("delete") afterPass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>": execCommand("delete", false, "") return valuePass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" checks for modifications to non-editable content-Fail [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" compare innerHTML+Pass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" compare innerHTMLPass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandIndeterm("delete") beforePass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandState("delete") beforePass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandValue("delete") before@@ -563,10 +563,10 @@ Pass [["delete",""]] "<ul><li><span>[abc</span></li><li>def]</li></ul>" checks fPass [["delete",""]] "<ul><li><span>[abc</span></li><li>def]</li></ul>" compare innerHTMLPass [["delete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>": execCommand("delete", false, "") return valuePass [["delete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>" checks for modifications to non-editable content-Fail [["delete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>" compare innerHTML+Pass [["delete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>" compare innerHTMLPass [["delete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>": execCommand("delete", false, "") return valuePass [["delete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>" checks for modifications to non-editable content-Fail [["delete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>" compare innerHTML+Pass [["delete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>" compare innerHTMLPass [["delete",""]] "<ul><li> [abc</li><li>def]</li></ul>": execCommand("delete", false, "") return valuePass [["delete",""]] "<ul><li> [abc</li><li>def]</li></ul>" checks for modifications to non-editable contentPass [["delete",""]] "<ul><li> [abc</li><li>def]</li></ul>" compare innerHTML@@ -650,10 +650,10 @@ Pass [["delete",""]] "<div><font><table><td>a</table><br>{}<br><table><td>b</tabFail [["delete",""]] "<div><font><table><td>a</table><br>{}<br><table><td>b</table></font></div>" compare innerHTMLPass [["delete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>": execCommand("delete", false, "") return valuePass [["delete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" checks for modifications to non-editable content-Fail [["delete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTML+Pass [["delete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTMLPass [["delete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>": execCommand("delete", false, "") return valuePass [["delete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" checks for modifications to non-editable content-Fail [["delete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTML+Pass [["delete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTMLPass [["delete",""]] "<div style=display:flex><span>abc</span><span>[]def</span></div>": execCommand("delete", false, "") return valuePass [["delete",""]] "<div style=display:flex><span>abc</span><span>[]def</span></div>" checks for modifications to non-editable contentPass [["delete",""]] "<div style=display:flex><span>abc</span><span>[]def</span></div>" compare innerHTMLdiff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]index d199f9dde01..6ea532d06f4 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]@@ -2,8 +2,8 @@ Harness status: OKFound 1000 tests-959 Pass-41 Fail+970 Pass+30 FailFail [["forwarddelete",""]] "<ol><li>foo[<li>]bar</ol>" compare innerHTMLPass [["forwarddelete",""]] "<ol><li>foo[<li>]bar</ol>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<ol><li>foo[<li>]bar</ol>" queryCommandState("forwarddelete") before@@ -352,7 +352,7 @@ Pass [["forwarddelete",""]] "<ul><li>foo</ul><p>{}<br></p><ol><li>bar</ol>" querPass [["forwarddelete",""]] "<ul><li>foo</ul><p>{}<br></p><ol><li>bar</ol>" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<p><b>[foo]</b>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<p><b>[foo]</b>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<p><b>[foo]</b>" compare innerHTML+Pass [["forwarddelete",""]] "<p><b>[foo]</b>" compare innerHTMLPass [["forwarddelete",""]] "<p><b>[foo]</b>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<p><b>[foo]</b>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<p><b>[foo]</b>" queryCommandValue("forwarddelete") before@@ -361,7 +361,7 @@ Pass [["forwarddelete",""]] "<p><b>[foo]</b>" queryCommandState("forwarddelete")Pass [["forwarddelete",""]] "<p><b>[foo]</b>" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" compare innerHTML+Pass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" compare innerHTMLPass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandValue("forwarddelete") before@@ -370,7 +370,7 @@ Pass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandState("forwaPass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" compare innerHTML+Pass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" compare innerHTMLPass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandValue("forwarddelete") before@@ -379,7 +379,7 @@ Pass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandState("forwarddPass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<p><b>{foo}</b>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<p><b>{foo}</b>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<p><b>{foo}</b>" compare innerHTML+Pass [["forwarddelete",""]] "<p><b>{foo}</b>" compare innerHTMLPass [["forwarddelete",""]] "<p><b>{foo}</b>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<p><b>{foo}</b>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<p><b>{foo}</b>" queryCommandValue("forwarddelete") before@@ -388,7 +388,7 @@ Pass [["forwarddelete",""]] "<p><b>{foo}</b>" queryCommandState("forwarddelete")Pass [["forwarddelete",""]] "<p><b>{foo}</b>" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<p>{<b>foo</b>}": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<p>{<b>foo</b>}" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<p>{<b>foo</b>}" compare innerHTML+Pass [["forwarddelete",""]] "<p>{<b>foo</b>}" compare innerHTMLPass [["forwarddelete",""]] "<p>{<b>foo</b>}" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<p>{<b>foo</b>}" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<p>{<b>foo</b>}" queryCommandValue("forwarddelete") before@@ -397,7 +397,7 @@ Pass [["forwarddelete",""]] "<p>{<b>foo</b>}" queryCommandState("forwarddelete")Pass [["forwarddelete",""]] "<p>{<b>foo</b>}" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<p><b>[]f</b>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<p><b>[]f</b>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<p><b>[]f</b>" compare innerHTML+Pass [["forwarddelete",""]] "<p><b>[]f</b>" compare innerHTMLPass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandValue("forwarddelete") before@@ -406,7 +406,7 @@ Pass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandState("forwarddelete") aPass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<b>[foo]</b>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<b>[foo]</b>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<b>[foo]</b>" compare innerHTML+Pass [["forwarddelete",""]] "<b>[foo]</b>" compare innerHTMLPass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandValue("forwarddelete") before@@ -415,7 +415,7 @@ Pass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandState("forwarddelete") afPass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<div><b>[foo]</b></div>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<div><b>[foo]</b></div>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<div><b>[foo]</b></div>" compare innerHTML+Pass [["forwarddelete",""]] "<div><b>[foo]</b></div>" compare innerHTMLPass [["forwarddelete",""]] "<div><b>[foo]</b></div>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<div><b>[foo]</b></div>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<div><b>[foo]</b></div>" queryCommandValue("forwarddelete") before@@ -631,7 +631,7 @@ Pass [["forwarddelete",""]] "foo<span>bar[]<span contenteditable=false>baz</spanPass [["forwarddelete",""]] "foo<span>bar[]<span contenteditable=false>baz</span></span>qux" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<span>[abc]</span>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<span>[abc]</span>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<span>[abc]</span>" compare innerHTML+Pass [["forwarddelete",""]] "<span>[abc]</span>" compare innerHTMLPass [["forwarddelete",""]] "<span>[abc]</span>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<span>[abc]</span>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<span>[abc]</span>" queryCommandValue("forwarddelete") before@@ -649,7 +649,7 @@ Pass [["forwarddelete",""]] "<span>[abc]</span><br>" queryCommandState("forwarddPass [["forwarddelete",""]] "<span>[abc]</span><br>" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<p><span>[abc]</span></p>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<p><span>[abc]</span></p>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<p><span>[abc]</span></p>" compare innerHTML+Pass [["forwarddelete",""]] "<p><span>[abc]</span></p>" compare innerHTMLPass [["forwarddelete",""]] "<p><span>[abc]</span></p>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<p><span>[abc]</span></p>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<p><span>[abc]</span></p>" queryCommandValue("forwarddelete") before@@ -919,7 +919,7 @@ Pass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contPass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>[ab</b></p><p><i>c]d</i></p></custom-element></div>" queryCommandValue("forwarddelete") afterPass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" compare innerHTML+Pass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" compare innerHTMLPass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandIndeterm("forwarddelete") beforePass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandState("forwarddelete") beforePass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandValue("forwarddelete") beforediff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]index cabcec72ad3..606394a6687 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]@@ -2,8 +2,8 @@ Harness status: OKFound 491 tests-471 Pass-20 Fail+475 Pass+16 FailPass [["styleWithCSS","false"],["defaultparagraphseparator","p"],["forwarddelete",""]] "<p><font size=3>foo[]</font><p><font size=5>bar</font>": execCommand("styleWithCSS", false, "false") return valuePass [["styleWithCSS","false"],["defaultparagraphseparator","p"],["forwarddelete",""]] "<p><font size=3>foo[]</font><p><font size=5>bar</font>": execCommand("defaultparagraphseparator", false, "p") return valuePass [["styleWithCSS","false"],["defaultparagraphseparator","p"],["forwarddelete",""]] "<p><font size=3>foo[]</font><p><font size=5>bar</font>": execCommand("forwarddelete", false, "") return value@@ -230,10 +230,10 @@ Pass [["forwarddelete",""]] "<ul><li><span>[abc</span></li><li>def]</li></ul>" cPass [["forwarddelete",""]] "<ul><li><span>[abc</span></li><li>def]</li></ul>" compare innerHTMLPass [["forwarddelete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>" compare innerHTML+Pass [["forwarddelete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>" compare innerHTMLPass [["forwarddelete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>" compare innerHTML+Pass [["forwarddelete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>" compare innerHTMLPass [["forwarddelete",""]] "<ul><li> [abc</li><li>def]</li></ul>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<ul><li> [abc</li><li>def]</li></ul>" checks for modifications to non-editable contentPass [["forwarddelete",""]] "<ul><li> [abc</li><li>def]</li></ul>" compare innerHTML@@ -317,10 +317,10 @@ Pass [["forwarddelete",""]] "<div><font><table><td>a</table>{}<br><br><table><tdFail [["forwarddelete",""]] "<div><font><table><td>a</table>{}<br><br><table><td>b</table></font></div>" compare innerHTMLPass [["forwarddelete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTML+Pass [["forwarddelete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTMLPass [["forwarddelete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" checks for modifications to non-editable content-Fail [["forwarddelete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTML+Pass [["forwarddelete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTMLPass [["forwarddelete",""]] "<div style=display:flex><span>abc[]</span><span>def</span></div>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""]] "<div style=display:flex><span>abc[]</span><span>def</span></div>" checks for modifications to non-editable contentPass [["forwarddelete",""]] "<div style=display:flex><span>abc[]</span><span>def</span></div>" compare innerHTMLdiff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]index 6a9224f4747..0a61e51ba78 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]@@ -2,8 +2,8 @@ Harness status: OKFound 1009 tests-982 Pass-27 Fail+984 Pass+25 FailPass [["stylewithcss","false"],["inserttext","a"]] "[foo<a href=http://www.google.com><font color=blue>bar]</font></a>baz" queryCommandValue("stylewithcss") afterPass [["stylewithcss","false"],["inserttext","a"]] "[foo<a href=http://www.google.com><font color=blue>bar]</font></a>baz" queryCommandIndeterm("inserttext") beforePass [["stylewithcss","false"],["inserttext","a"]] "[foo<a href=http://www.google.com><font color=blue>bar]</font></a>baz" queryCommandState("inserttext") before@@ -927,10 +927,10 @@ Pass [["inserttext","g"],["inserttext","h"]] "<div style=display:grid><span>abc<Fail [["inserttext","g"],["inserttext","h"]] "<div style=display:grid><span>abc</span><span><b>{def</b></span>}</div>" compare innerHTMLPass [["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>": execCommand("inserttext", false, "B") return valuePass [["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" checks for modifications to non-editable content-Fail [["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTML+Pass [["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTMLPass [["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>": execCommand("inserttext", false, "B") return valuePass [["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" checks for modifications to non-editable content-Fail [["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTML+Pass [["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" compare innerHTMLPass [["inserttext"," "]] "<div style=display:flex><span>[]abc</span><span>def</span></div>": execCommand("inserttext", false, " ") return valuePass [["inserttext"," "]] "<div style=display:flex><span>[]abc</span><span>def</span></div>" checks for modifications to non-editable contentPass [["inserttext"," "]] "<div style=display:flex><span>[]abc</span><span>def</span></div>" compare innerHTMLdiff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]index 1849dfdc4a0..d1599b54008 100644--- a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]@@ -2,8 +2,8 @@ Harness status: OKFound 1092 tests-1014 Pass-78 Fail+1016 Pass+76 FailPass [["delete",""],["inserttext","a"]] "foo<font color=#0000FF>[bar</font>baz]" queryCommandIndeterm("inserttext") beforePass [["delete",""],["inserttext","a"]] "foo<font color=#0000FF>[bar</font>baz]" queryCommandState("inserttext") beforePass [["delete",""],["inserttext","a"]] "foo<font color=#0000FF>[bar</font>baz]" queryCommandValue("inserttext") before@@ -1062,7 +1062,7 @@ Pass [["forwarddelete",""],["inserttext","Y"]] "<b><span contenteditable=false>aPass [["delete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>": execCommand("delete", false, "") return valuePass [["delete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>": execCommand("inserttext", false, "B") return valuePass [["delete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" checks for modifications to non-editable content-Fail [["delete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTML+Pass [["delete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTMLPass [["delete",""],["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>": execCommand("delete", false, "") return valuePass [["delete",""],["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>": execCommand("inserttext", false, "B") return valuePass [["delete",""],["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" checks for modifications to non-editable content@@ -1070,7 +1070,7 @@ Fail [["delete",""],["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</Pass [["forwarddelete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>": execCommand("inserttext", false, "B") return valuePass [["forwarddelete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" checks for modifications to non-editable content-Fail [["forwarddelete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTML+Pass [["forwarddelete",""],["inserttext","B"]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>" compare innerHTMLPass [["forwarddelete",""],["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>": execCommand("forwarddelete", false, "") return valuePass [["forwarddelete",""],["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>": execCommand("inserttext", false, "B") return valuePass [["forwarddelete",""],["inserttext","B"]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>" checks for modifications to non-editable content