Skip to content

Truly independent web browser

LibWeb: Keep author white-space styles of pre when joining paragraphs

Andreas Klinge4efd4aa8b34
diff --git a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp
index 94adb45721f..6c23cbed850 100644
--- a/Libraries/LibWeb/Editing/Internal/Algorithms.cpp
+++ b/Libraries/LibWeb/Editing/Internal/Algorithms.cpp
@@ -9,9 +9,15 @@
#include <LibGC/RootVector.h>
#include <LibGfx/Color.h>
#include <LibWeb/Bindings/Document.h>
+#include <LibWeb/CSS/CSSGroupingRule.h>
+#include <LibWeb/CSS/CSSRuleList.h>
+#include <LibWeb/CSS/CSSStyleProperties.h>
+#include <LibWeb/CSS/CSSStyleRule.h>
+#include <LibWeb/CSS/CSSStyleSheet.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/PropertyNameAndID.h>
#include <LibWeb/CSS/StyleComputer.h>
+#include <LibWeb/CSS/StyleSheetList.h>
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
@@ -950,15 +956,46 @@ static GC::Ptr<DOM::Element> element_establishing_white_space(GC::Ref<DOM::Node>
return as_if<DOM::Element>(establishing_node.ptr());
}
+// Whether a style rule in one of the author style sheets of element's document sets its white-space style.
+// NB: This looks at the rules that match element, and not at the cascade, so it also finds rules that are overridden.
+static bool author_style_sheet_sets_white_space(DOM::Element& element)
+{
+ auto rule_list_sets_white_space = [&](auto& self, CSS::CSSRuleList& rules) -> bool {
+ for (size_t index = 0; index < rules.length(); ++index) {
+ auto* rule = rules.item(index);
+ if (auto* style_rule = as_if<CSS::CSSStyleRule>(rule); style_rule
+ && style_rule->style()->has_property(CSS::PropertyID::WhiteSpaceCollapse)) {
+ auto matches = element.matches(style_rule->selector_text());
+ if (!matches.is_error() && matches.value())
+ return true;
+ }
+ if (auto* grouping_rule = as_if<CSS::CSSGroupingRule>(rule); grouping_rule && self(self, grouping_rule->css_rules()))
+ return true;
+ }
+ return false;
+ };
+
+ auto& style_sheets = element.document().style_sheets();
+ for (size_t index = 0; index < style_sheets.length(); ++index) {
+ auto* style_sheet = style_sheets.item(index);
+ if (!style_sheet || style_sheet->disabled())
+ continue;
+ auto rules = style_sheet->css_rules();
+ if (!rules.is_error() && rule_list_sets_white_space(rule_list_sets_white_space, *rules.value()))
+ return true;
+ }
+ return false;
+}
+
// INTEROP: Browsers do not keep white-space styles that come from the default style of elements such as pre, and do not
-// add white-space styles to content that is joined into such an element.
-// FIXME: Distinguish these from white-space styles that author style sheets set on such elements.
+// add white-space styles to content that is joined into such an element. They do keep white-space styles that
+// the style attribute or author style sheets set on such elements.
static bool white_space_is_from_default_style(GC::Ref<DOM::Node> node)
{
auto element = element_establishing_white_space(node);
return element
&& element->local_name().is_one_of(HTML::TagNames::pre, HTML::TagNames::listing, HTML::TagNames::xmp, HTML::TagNames::plaintext)
- && !sets_white_space_in_style_attribute(*element);
+ && !sets_white_space_in_style_attribute(*element) && !author_style_sheet_sets_white_space(*element);
}
// Whether element gives its children formatting that its parent does not, as one of the command values that are
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=blockquote.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=blockquote.txt
index c803bddda8f..ffa4c904117 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=blockquote.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=blockquote.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 46 tests
-18 Pass
-28 Fail
+36 Pass
+10 Fail
Fail delete at <pre>abc</pre><blockquote>[]def</blockquote>
Fail delete at <pre>abc</pre>\n<blockquote>[]def</blockquote>
Pass delete at <blockquote>abc</blockquote><pre>[]def</pre>
@@ -32,21 +32,21 @@ Pass delete at <blockquote>abc</blockquote><pre><b>[]def\n</b>ghi</pre>
Pass delete at <blockquote>abc</blockquote>\n<pre><b>[]def\n</b>ghi</pre>
Pass delete at <blockquote>abc</blockquote><pre><b>[]def<br></b>ghi</pre>
Pass delete at <blockquote>abc</blockquote>\n<pre><b>[]def<br></b>ghi</pre>
-Fail delete at <blockquote>abc</blockquote><pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote>\n<pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote><pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote>\n<pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote><pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote>\n<pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote><pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote>\n<pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote><pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote>\n<pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote><pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote>\n<pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote><pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote>\n<pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote><pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote>\n<pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote><pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc</blockquote>\n<pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
+Pass delete at <blockquote>abc</blockquote><pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote>\n<pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote><pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote>\n<pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote><pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote>\n<pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote><pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote>\n<pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote><pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote>\n<pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote><pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote>\n<pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote><pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote>\n<pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote><pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote>\n<pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote><pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc</blockquote>\n<pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=div.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=div.txt
index cf268188755..f43ffb71d5f 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=div.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=div.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 46 tests
-28 Pass
-18 Fail
+46 Pass
Pass delete at <pre>abc</pre><div>[]def</div>
Pass delete at <pre>abc</pre>\n<div>[]def</div>
Pass delete at <div>abc</div><pre>[]def</pre>
@@ -32,21 +31,21 @@ Pass delete at <div>abc</div><pre><b>[]def\n</b>ghi</pre>
Pass delete at <div>abc</div>\n<pre><b>[]def\n</b>ghi</pre>
Pass delete at <div>abc</div><pre><b>[]def<br></b>ghi</pre>
Pass delete at <div>abc</div>\n<pre><b>[]def<br></b>ghi</pre>
-Fail delete at <div>abc</div><pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div>\n<pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div><pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div>\n<pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div><pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div>\n<pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div><pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div>\n<pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div><pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div>\n<pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div><pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div>\n<pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div><pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div>\n<pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div><pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div>\n<pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div><pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc</div>\n<pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
+Pass delete at <div>abc</div><pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div>\n<pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div><pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div>\n<pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div><pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div>\n<pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div><pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div>\n<pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div><pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div>\n<pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div><pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div>\n<pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div><pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div>\n<pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div><pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div>\n<pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div><pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc</div>\n<pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=p.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=p.txt
index 3644d532714..b71a68a0ba0 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=p.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=backspace&block=p.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 44 tests
-26 Pass
-18 Fail
+44 Pass
Pass delete at <pre>abc</pre><p>[]def</p>
Pass delete at <pre>abc</pre>\n<p>[]def</p>
Pass delete at <p>abc</p><pre>[]def</pre>
@@ -30,21 +29,21 @@ Pass delete at <p>abc</p><pre><b>[]def\n</b>ghi</pre>
Pass delete at <p>abc</p>\n<pre><b>[]def\n</b>ghi</pre>
Pass delete at <p>abc</p><pre><b>[]def<br></b>ghi</pre>
Pass delete at <p>abc</p>\n<pre><b>[]def<br></b>ghi</pre>
-Fail delete at <p>abc</p><pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p>\n<pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p><pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p>\n<pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p><pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p>\n<pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p><pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p>\n<pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p><pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p>\n<pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p><pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p>\n<pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p><pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p>\n<pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p><pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p>\n<pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p><pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc</p>\n<pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
+Pass delete at <p>abc</p><pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p>\n<pre>[]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p><pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p>\n<pre>[]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p><pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p>\n<pre>[]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p><pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p>\n<pre><b>[]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p><pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p>\n<pre><b>[]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p><pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p>\n<pre><b>[]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p><pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p>\n<pre><b>[]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p><pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p>\n<pre><b>[]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p><pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc</p>\n<pre><b>[]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=blockquote.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=blockquote.txt
index 655356e8159..77e5d1a15fe 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=blockquote.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=blockquote.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 52 tests
-32 Pass
-20 Fail
+52 Pass
Pass forwarddelete at <pre>abc[]</pre><blockquote>def</blockquote>
Pass forwarddelete at <pre>abc[]</pre>\n<blockquote>def</blockquote>
Pass forwarddelete at <blockquote>abc[]</blockquote><pre>def</pre>
@@ -36,23 +35,23 @@ Pass forwarddelete at <blockquote>abc[]</blockquote><pre>\ndef\nghi</pre>
Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre>\ndef\nghi</pre>
Pass forwarddelete at <blockquote>abc[]</blockquote><pre>\n\ndef\nghi</pre>
Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre>\n\ndef\nghi</pre>
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre>def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre>def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote><pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <blockquote>abc[]</blockquote>\n<pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre>def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre>def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote><pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <blockquote>abc[]</blockquote>\n<pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=div.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=div.txt
index 251ba71254c..cfc58376d91 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=div.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=div.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 52 tests
-32 Pass
-20 Fail
+52 Pass
Pass forwarddelete at <pre>abc[]</pre><div>def</div>
Pass forwarddelete at <pre>abc[]</pre>\n<div>def</div>
Pass forwarddelete at <div>abc[]</div><pre>def</pre>
@@ -36,23 +35,23 @@ Pass forwarddelete at <div>abc[]</div><pre>\ndef\nghi</pre>
Pass forwarddelete at <div>abc[]</div>\n<pre>\ndef\nghi</pre>
Pass forwarddelete at <div>abc[]</div><pre>\n\ndef\nghi</pre>
Pass forwarddelete at <div>abc[]</div>\n<pre>\n\ndef\nghi</pre>
-Fail forwarddelete at <div>abc[]</div><pre>def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre>def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div><pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div><pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div><pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div><pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div><pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div><pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div><pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div><pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div><pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <div>abc[]</div>\n<pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
+Pass forwarddelete at <div>abc[]</div><pre>def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre>def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div><pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div><pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div><pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div><pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div><pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div><pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div><pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div><pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div><pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <div>abc[]</div>\n<pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=p.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=p.txt
index 65352c518cc..dfeecb33e01 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=p.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=forwarddelete&block=p.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 50 tests
-30 Pass
-20 Fail
+50 Pass
Pass forwarddelete at <pre>abc[]</pre><p>def</p>
Pass forwarddelete at <pre>abc[]</pre>\n<p>def</p>
Pass forwarddelete at <p>abc[]</p><pre>def</pre>
@@ -34,23 +33,23 @@ Pass forwarddelete at <p>abc[]</p><pre>\ndef\nghi</pre>
Pass forwarddelete at <p>abc[]</p>\n<pre>\ndef\nghi</pre>
Pass forwarddelete at <p>abc[]</p><pre>\n\ndef\nghi</pre>
Pass forwarddelete at <p>abc[]</p>\n<pre>\n\ndef\nghi</pre>
-Fail forwarddelete at <p>abc[]</p><pre>def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre>def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p><pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p><pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p><pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p><pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p><pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p><pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p><pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p><pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p><pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail forwarddelete at <p>abc[]</p>\n<pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
+Pass forwarddelete at <p>abc[]</p><pre>def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre>def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p><pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre>def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p><pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre>def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p><pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre><b>def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p><pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre><b>def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p><pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre><b>def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p><pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre><b>def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p><pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre><b>def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p><pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre><b>def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p><pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass forwarddelete at <p>abc[]</p>\n<pre>\ndef\nghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=blockquote.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=blockquote.txt
index 80146bf31fc..eb062ca54b1 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=blockquote.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=blockquote.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 46 tests
-28 Pass
-18 Fail
+46 Pass
Pass delete at <pre>abc[</pre><blockquote>]def</blockquote>
Pass delete at <pre>abc[</pre>\n<blockquote>]def</blockquote>
Pass delete at <blockquote>abc[</blockquote><pre>]def</pre>
@@ -32,21 +31,21 @@ Pass delete at <blockquote>abc[</blockquote><pre><b>]def\n</b>ghi</pre>
Pass delete at <blockquote>abc[</blockquote>\n<pre><b>]def\n</b>ghi</pre>
Pass delete at <blockquote>abc[</blockquote><pre><b>]def<br></b>ghi</pre>
Pass delete at <blockquote>abc[</blockquote>\n<pre><b>]def<br></b>ghi</pre>
-Fail delete at <blockquote>abc[</blockquote><pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote>\n<pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote><pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote>\n<pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote><pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote>\n<pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote><pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote>\n<pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote><pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote>\n<pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote><pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote>\n<pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote><pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote>\n<pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote><pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote>\n<pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote><pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <blockquote>abc[</blockquote>\n<pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
+Pass delete at <blockquote>abc[</blockquote><pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote>\n<pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote><pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote>\n<pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote><pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote>\n<pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote><pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote>\n<pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote><pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote>\n<pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote><pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote>\n<pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote><pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote>\n<pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote><pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote>\n<pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote><pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <blockquote>abc[</blockquote>\n<pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=div.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=div.txt
index 6e8f5862553..bcc10c44ec7 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=div.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=div.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 46 tests
-28 Pass
-18 Fail
+46 Pass
Pass delete at <pre>abc[</pre><div>]def</div>
Pass delete at <pre>abc[</pre>\n<div>]def</div>
Pass delete at <div>abc[</div><pre>]def</pre>
@@ -32,21 +31,21 @@ Pass delete at <div>abc[</div><pre><b>]def\n</b>ghi</pre>
Pass delete at <div>abc[</div>\n<pre><b>]def\n</b>ghi</pre>
Pass delete at <div>abc[</div><pre><b>]def<br></b>ghi</pre>
Pass delete at <div>abc[</div>\n<pre><b>]def<br></b>ghi</pre>
-Fail delete at <div>abc[</div><pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div>\n<pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div><pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div>\n<pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div><pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div>\n<pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div><pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div>\n<pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div><pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div>\n<pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div><pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div>\n<pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div><pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div>\n<pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div><pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div>\n<pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div><pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <div>abc[</div>\n<pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
+Pass delete at <div>abc[</div><pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div>\n<pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div><pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div>\n<pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div><pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div>\n<pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div><pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div>\n<pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div><pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div>\n<pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div><pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div>\n<pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div><pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div>\n<pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div><pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div>\n<pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div><pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <div>abc[</div>\n<pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=p.txt b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=p.txt
index 7fdb696cf04..4e0f7b8c8c6 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=p.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/other/join-pre-and-other-block@method=select-boundary&block=p.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 44 tests
-26 Pass
-18 Fail
+44 Pass
Pass delete at <pre>abc[</pre><p>]def</p>
Pass delete at <pre>abc[</pre>\n<p>]def</p>
Pass delete at <p>abc[</p><pre>]def</pre>
@@ -30,21 +29,21 @@ Pass delete at <p>abc[</p><pre><b>]def\n</b>ghi</pre>
Pass delete at <p>abc[</p>\n<pre><b>]def\n</b>ghi</pre>
Pass delete at <p>abc[</p><pre><b>]def<br></b>ghi</pre>
Pass delete at <p>abc[</p>\n<pre><b>]def<br></b>ghi</pre>
-Fail delete at <p>abc[</p><pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p>\n<pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p><pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p>\n<pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p><pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p>\n<pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p><pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p>\n<pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p><pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p>\n<pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p><pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p>\n<pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p><pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p>\n<pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p><pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p>\n<pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p><pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
-Fail delete at <p>abc[</p>\n<pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file
+Pass delete at <p>abc[</p><pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p>\n<pre>]def</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p><pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p>\n<pre>]def\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p><pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p>\n<pre>]def<br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p><pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p>\n<pre><b>]def\nghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p><pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p>\n<pre><b>]def<br>ghi</b></pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p><pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p>\n<pre><b>]def</b>\nghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p><pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p>\n<pre><b>]def</b><br>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p><pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p>\n<pre><b>]def\n</b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p><pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
+Pass delete at <p>abc[</p>\n<pre><b>]def<br></b>ghi</pre> (with <style>pre { white-space: pre; }</style>)
\ No newline at end of file