Skip to content

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.cpp
index 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: OK
Found 1000 tests
-979 Pass
-21 Fail
+989 Pass
+11 Fail
Pass [["defaultparagraphseparator","div"],["delete",""]] "<p>foo<ol><li>bar<li>ba[z</ol><p>q]uz" queryCommandState("delete") before
Pass [["defaultparagraphseparator","div"],["delete",""]] "<p>foo<ol><li>bar<li>ba[z</ol><p>q]uz" queryCommandValue("delete") before
Pass [["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>{}<br
Pass [["defaultparagraphseparator","p"],["delete",""]] "<ul><li>foo</ul><p>{}<br></p><ol><li>bar</ol>" queryCommandValue("delete") after
Pass [["delete",""]] "<p><b>[foo]</b>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<p><b>[foo]</b>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<p><b>[foo]</b>" queryCommandState("delete") before
Pass [["delete",""]] "<p><b>[foo]</b>" queryCommandValue("delete") before
@@ -694,7 +694,7 @@ Pass [["delete",""]] "<p><b>[foo]</b>" queryCommandState("delete") after
Pass [["delete",""]] "<p><b>[foo]</b>" queryCommandValue("delete") after
Pass [["delete",""]] "<p><quasit>[foo]</quasit>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandState("delete") before
Pass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandValue("delete") before
@@ -703,7 +703,7 @@ Pass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandState("delete") aft
Pass [["delete",""]] "<p><quasit>[foo]</quasit>" queryCommandValue("delete") after
Pass [["delete",""]] "<p><b><i>[foo]</i></b>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandState("delete") before
Pass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandValue("delete") before
@@ -712,7 +712,7 @@ Pass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandState("delete") after
Pass [["delete",""]] "<p><b><i>[foo]</i></b>" queryCommandValue("delete") after
Pass [["delete",""]] "<p><b>{foo}</b>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<p><b>{foo}</b>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<p><b>{foo}</b>" queryCommandState("delete") before
Pass [["delete",""]] "<p><b>{foo}</b>" queryCommandValue("delete") before
@@ -721,7 +721,7 @@ Pass [["delete",""]] "<p><b>{foo}</b>" queryCommandState("delete") after
Pass [["delete",""]] "<p><b>{foo}</b>" queryCommandValue("delete") after
Pass [["delete",""]] "<p>{<b>foo</b>}": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<p>{<b>foo</b>}" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<p>{<b>foo</b>}" queryCommandState("delete") before
Pass [["delete",""]] "<p>{<b>foo</b>}" queryCommandValue("delete") before
@@ -730,7 +730,7 @@ Pass [["delete",""]] "<p>{<b>foo</b>}" queryCommandState("delete") after
Pass [["delete",""]] "<p>{<b>foo</b>}" queryCommandValue("delete") after
Pass [["delete",""]] "<p><b>f[]</b>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<p><b>f[]</b>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<p><b>f[]</b>" queryCommandState("delete") before
Pass [["delete",""]] "<p><b>f[]</b>" queryCommandValue("delete") before
@@ -739,7 +739,7 @@ Pass [["delete",""]] "<p><b>f[]</b>" queryCommandState("delete") after
Pass [["delete",""]] "<p><b>f[]</b>" queryCommandValue("delete") after
Pass [["delete",""]] "<b>[foo]</b>": execCommand("delete", false, "") return value
Pass [["delete",""]] "<b>[foo]</b>" checks for modifications to non-editable content
-Fail [["delete",""]] "<b>[foo]</b>" compare innerHTML
+Pass [["delete",""]] "<b>[foo]</b>" compare innerHTML
Pass [["delete",""]] "<b>[foo]</b>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<b>[foo]</b>" queryCommandState("delete") before
Pass [["delete",""]] "<b>[foo]</b>" queryCommandValue("delete") before
@@ -748,7 +748,7 @@ Pass [["delete",""]] "<b>[foo]</b>" queryCommandState("delete") after
Pass [["delete",""]] "<b>[foo]</b>" queryCommandValue("delete") after
Pass [["delete",""]] "<div><b>[foo]</b></div>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<div><b>[foo]</b></div>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<div><b>[foo]</b></div>" queryCommandState("delete") before
Pass [["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") after
Pass [["delete",""]] "<span>[abc]</span>": execCommand("delete", false, "") return value
Pass [["delete",""]] "<span>[abc]</span>" checks for modifications to non-editable content
-Fail [["delete",""]] "<span>[abc]</span>" compare innerHTML
+Pass [["delete",""]] "<span>[abc]</span>" compare innerHTML
Pass [["delete",""]] "<span>[abc]</span>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<span>[abc]</span>" queryCommandState("delete") before
Pass [["delete",""]] "<span>[abc]</span>" queryCommandValue("delete") before
@@ -982,7 +982,7 @@ Pass [["delete",""]] "<span>[abc]</span><br>" queryCommandState("delete") after
Pass [["delete",""]] "<span>[abc]</span><br>" queryCommandValue("delete") after
Pass [["delete",""]] "<p><span>[abc]</span></p>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<p><span>[abc]</span></p>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<p><span>[abc]</span></p>" queryCommandState("delete") before
Pass [["delete",""]] "<p><span>[abc]</span></p>" queryCommandValue("delete") before
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 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: OK
Found 842 tests
-806 Pass
-36 Fail
+811 Pass
+31 Fail
Pass [["delete",""]] "<p contenteditable=false><span contenteditable=true>[abc]</span></p>" queryCommandIndeterm("delete") after
Pass [["delete",""]] "<p contenteditable=false><span contenteditable=true>[abc]</span></p>" queryCommandState("delete") after
Pass [["delete",""]] "<p contenteditable=false><span contenteditable=true>[abc]</span></p>" queryCommandValue("delete") after
@@ -252,7 +252,7 @@ Pass [["delete",""]] "<div contenteditable=\"false\"><custom-element contentedit
Pass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>[ab</b></p><p><i>c]d</i></p></custom-element></div>" queryCommandValue("delete") after
Pass [["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 value
Pass [["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 innerHTML
Pass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandIndeterm("delete") before
Pass [["delete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandState("delete") before
Pass [["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 f
Pass [["delete",""]] "<ul><li><span>[abc</span></li><li>def]</li></ul>" compare innerHTML
Pass [["delete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<ul><li> [abc</li><li>def]</li></ul>": execCommand("delete", false, "") return value
Pass [["delete",""]] "<ul><li> [abc</li><li>def]</li></ul>" checks for modifications to non-editable content
Pass [["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</tab
Fail [["delete",""]] "<div><font><table><td>a</table><br>{}<br><table><td>b</table></font></div>" compare innerHTML
Pass [["delete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>": execCommand("delete", false, "") return value
Pass [["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 innerHTML
Pass [["delete",""]] "<div style=display:flex><span>abc</span><span>[]def</span></div>": execCommand("delete", false, "") return value
Pass [["delete",""]] "<div style=display:flex><span>abc</span><span>[]def</span></div>" checks for modifications to non-editable content
Pass [["delete",""]] "<div style=display:flex><span>abc</span><span>[]def</span></div>" compare innerHTML
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 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: OK
Found 1000 tests
-959 Pass
-41 Fail
+970 Pass
+30 Fail
Fail [["forwarddelete",""]] "<ol><li>foo[<li>]bar</ol>" compare innerHTML
Pass [["forwarddelete",""]] "<ol><li>foo[<li>]bar</ol>" queryCommandIndeterm("forwarddelete") before
Pass [["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>" quer
Pass [["forwarddelete",""]] "<ul><li>foo</ul><p>{}<br></p><ol><li>bar</ol>" queryCommandValue("forwarddelete") after
Pass [["forwarddelete",""]] "<p><b>[foo]</b>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<p><b>[foo]</b>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<p><b>[foo]</b>" queryCommandState("forwarddelete") before
Pass [["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") after
Pass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandState("forwarddelete") before
Pass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandValue("forwarddelete") before
@@ -370,7 +370,7 @@ Pass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandState("forwa
Pass [["forwarddelete",""]] "<p><quasit>[foo]</quasit>" queryCommandValue("forwarddelete") after
Pass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandState("forwarddelete") before
Pass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandValue("forwarddelete") before
@@ -379,7 +379,7 @@ Pass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandState("forwardd
Pass [["forwarddelete",""]] "<p><b><i>[foo]</i></b>" queryCommandValue("forwarddelete") after
Pass [["forwarddelete",""]] "<p><b>{foo}</b>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<p><b>{foo}</b>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<p><b>{foo}</b>" queryCommandState("forwarddelete") before
Pass [["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") after
Pass [["forwarddelete",""]] "<p>{<b>foo</b>}": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<p>{<b>foo</b>}" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<p>{<b>foo</b>}" queryCommandState("forwarddelete") before
Pass [["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") after
Pass [["forwarddelete",""]] "<p><b>[]f</b>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandState("forwarddelete") before
Pass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandValue("forwarddelete") before
@@ -406,7 +406,7 @@ Pass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandState("forwarddelete") a
Pass [["forwarddelete",""]] "<p><b>[]f</b>" queryCommandValue("forwarddelete") after
Pass [["forwarddelete",""]] "<b>[foo]</b>": execCommand("forwarddelete", false, "") return value
Pass [["forwarddelete",""]] "<b>[foo]</b>" checks for modifications to non-editable content
-Fail [["forwarddelete",""]] "<b>[foo]</b>" compare innerHTML
+Pass [["forwarddelete",""]] "<b>[foo]</b>" compare innerHTML
Pass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandState("forwarddelete") before
Pass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandValue("forwarddelete") before
@@ -415,7 +415,7 @@ Pass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandState("forwarddelete") af
Pass [["forwarddelete",""]] "<b>[foo]</b>" queryCommandValue("forwarddelete") after
Pass [["forwarddelete",""]] "<div><b>[foo]</b></div>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<div><b>[foo]</b></div>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<div><b>[foo]</b></div>" queryCommandState("forwarddelete") before
Pass [["forwarddelete",""]] "<div><b>[foo]</b></div>" queryCommandValue("forwarddelete") before
@@ -631,7 +631,7 @@ Pass [["forwarddelete",""]] "foo<span>bar[]<span contenteditable=false>baz</span
Pass [["forwarddelete",""]] "foo<span>bar[]<span contenteditable=false>baz</span></span>qux" queryCommandValue("forwarddelete") after
Pass [["forwarddelete",""]] "<span>[abc]</span>": execCommand("forwarddelete", false, "") return value
Pass [["forwarddelete",""]] "<span>[abc]</span>" checks for modifications to non-editable content
-Fail [["forwarddelete",""]] "<span>[abc]</span>" compare innerHTML
+Pass [["forwarddelete",""]] "<span>[abc]</span>" compare innerHTML
Pass [["forwarddelete",""]] "<span>[abc]</span>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<span>[abc]</span>" queryCommandState("forwarddelete") before
Pass [["forwarddelete",""]] "<span>[abc]</span>" queryCommandValue("forwarddelete") before
@@ -649,7 +649,7 @@ Pass [["forwarddelete",""]] "<span>[abc]</span><br>" queryCommandState("forwardd
Pass [["forwarddelete",""]] "<span>[abc]</span><br>" queryCommandValue("forwarddelete") after
Pass [["forwarddelete",""]] "<p><span>[abc]</span></p>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<p><span>[abc]</span></p>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<p><span>[abc]</span></p>" queryCommandState("forwarddelete") before
Pass [["forwarddelete",""]] "<p><span>[abc]</span></p>" queryCommandValue("forwarddelete") before
@@ -919,7 +919,7 @@ Pass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element cont
Pass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>[ab</b></p><p><i>c]d</i></p></custom-element></div>" queryCommandValue("forwarddelete") after
Pass [["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 value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandIndeterm("forwarddelete") before
Pass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandState("forwarddelete") before
Pass [["forwarddelete",""]] "<div contenteditable=\"false\"><custom-element contenteditable=\"\"><p><b>a[b</b></p><p><i>cd]</i></p></custom-element></div>" queryCommandValue("forwarddelete") before
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 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: OK
Found 491 tests
-471 Pass
-20 Fail
+475 Pass
+16 Fail
Pass [["styleWithCSS","false"],["defaultparagraphseparator","p"],["forwarddelete",""]] "<p><font size=3>foo[]</font><p><font size=5>bar</font>": execCommand("styleWithCSS", false, "false") return value
Pass [["styleWithCSS","false"],["defaultparagraphseparator","p"],["forwarddelete",""]] "<p><font size=3>foo[]</font><p><font size=5>bar</font>": execCommand("defaultparagraphseparator", false, "p") return value
Pass [["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>" c
Pass [["forwarddelete",""]] "<ul><li><span>[abc</span></li><li>def]</li></ul>" compare innerHTML
Pass [["forwarddelete",""]] "<ul><li>[abc</li><li><span>def]</span></li></ul>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<ul><li><span>[abc</span></li><li><span>def]</span></li></ul>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<ul><li> [abc</li><li>def]</li></ul>": execCommand("forwarddelete", false, "") return value
Pass [["forwarddelete",""]] "<ul><li> [abc</li><li>def]</li></ul>" checks for modifications to non-editable content
Pass [["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><td
Fail [["forwarddelete",""]] "<div><font><table><td>a</table>{}<br><br><table><td>b</table></font></div>" compare innerHTML
Pass [["forwarddelete",""]] "<table><tr><td>a<td><b>[b</b><td><b>c</b><td><b>d]</b><td>e</table>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<table><tr><th>a<th><b>[b</b><th><b>c</b><th><b>d]</b><th>e</table>": execCommand("forwarddelete", false, "") return value
Pass [["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 innerHTML
Pass [["forwarddelete",""]] "<div style=display:flex><span>abc[]</span><span>def</span></div>": execCommand("forwarddelete", false, "") return value
Pass [["forwarddelete",""]] "<div style=display:flex><span>abc[]</span><span>def</span></div>" checks for modifications to non-editable content
Pass [["forwarddelete",""]] "<div style=display:flex><span>abc[]</span><span>def</span></div>" compare innerHTML
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 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: OK
Found 1009 tests
-982 Pass
-27 Fail
+984 Pass
+25 Fail
Pass [["stylewithcss","false"],["inserttext","a"]] "[foo<a href=http://www.google.com><font color=blue>bar]</font></a>baz" queryCommandValue("stylewithcss") after
Pass [["stylewithcss","false"],["inserttext","a"]] "[foo<a href=http://www.google.com><font color=blue>bar]</font></a>baz" queryCommandIndeterm("inserttext") before
Pass [["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 innerHTML
Pass [["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 value
Pass [["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 innerHTML
Pass [["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 value
Pass [["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 innerHTML
Pass [["inserttext"," "]] "<div style=display:flex><span>[]abc</span><span>def</span></div>": execCommand("inserttext", false, " ") return value
Pass [["inserttext"," "]] "<div style=display:flex><span>[]abc</span><span>def</span></div>" checks for modifications to non-editable content
Pass [["inserttext"," "]] "<div style=display:flex><span>[]abc</span><span>def</span></div>" compare innerHTML
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 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: OK
Found 1092 tests
-1014 Pass
-78 Fail
+1016 Pass
+76 Fail
Pass [["delete",""],["inserttext","a"]] "foo<font color=#0000FF>[bar</font>baz]" queryCommandIndeterm("inserttext") before
Pass [["delete",""],["inserttext","a"]] "foo<font color=#0000FF>[bar</font>baz]" queryCommandState("inserttext") before
Pass [["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>a
Pass [["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 value
Pass [["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 value
Pass [["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 innerHTML
Pass [["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 value
Pass [["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 value
Pass [["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 value
Pass [["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 value
Pass [["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 innerHTML
Pass [["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 value
Pass [["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 value
Pass [["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