Re: [whatwg/dom] Remove quadratic behavior from clone a node (PR #1334)

@smaug---- commented on this pull request.



> +  <ol>
+   <li><p><a for=/>Assert</a>: <var>copy</var> is not a <a for=Element>shadow host</a>.
+
+   <li><p><a>Attach a shadow root</a> with <var>copy</var>, <var>node</var>'s
+   <a for=Element>shadow root</a>'s <a for=ShadowRoot>mode</a>, true, <var>node</var>'s
+   <a for=Element>shadow root</a>'s <a for=ShadowRoot>serializable</a>, <var>node</var>'s
+   <a for=Element>shadow root</a>'s <a for=ShadowRoot>delegates focus</a>, and <var>node</var>'s
+   <a for=Element>shadow root</a>'s <a for=ShadowRoot>slot assignment</a>.
+
+   <li><p>Set <var>copy</var>'s <a for=Element>shadow root</a>'s <a for=ShadowRoot>declarative</a>
+   to <var>node</var>'s <a for=Element>shadow root</a>'s <a for=ShadowRoot>declarative</a>.
+
+   <li><p>For each <var>child</var> of <var>node</var>'s <a for=Element>shadow root</a>'s
+   <a for=tree>children</a>, in <a>tree order</a>: <a>clone a node and append</a> given
+   <var>child</var>, <var>copy</var>'s <a for=Element>shadow root</a>, <var>document</var>, and
+   <var>subtree</var>.

In Gecko shadow root attaching happens after going through children.
And the same seems to happen in Chrome too https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/dom/element.cc;l=689;drc=fe99dee25a6b65dbe6c9e97099334e9c027a24a1;bpv=0;bpt=1

The order of slotchange events is the same in Firefox and Chrome (h6, div, span), Safari has - I was told - div, span, h6.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/1334#pullrequestreview-2503288172
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/dom/pull/1334/review/2503288172@github.com>

Received on Friday, 13 December 2024 21:41:51 UTC