Make Element::attach_shadow() and ShadowRoot closer to spec (#36024)

Signed-off-by: batu_hoang <longvatrong111@gmail.com>
This commit is contained in:
batu_hoang 2025-03-20 01:58:16 +08:00 committed by GitHub
parent 11d47558b3
commit db74179dc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 117 additions and 158 deletions

View file

@ -2731,13 +2731,16 @@ impl Node {
copy_elem.attach_shadow(
IsUserAgentWidget::No,
shadow_root.Mode(),
true,
shadow_root.Clonable(),
shadow_root.Serializable(),
shadow_root.DelegatesFocus(),
shadow_root.SlotAssignment(),
can_gc
)
.expect("placement of attached shadow root must be valid, as this is a copy of an existing one");
// TODO: Step 7.3 Set copys shadow roots declarative to nodes shadow roots declarative.
// Step 7.3 Set copys shadow roots declarative to nodes shadow roots declarative.
copy_shadow_root.set_declarative(shadow_root.is_declarative());
// Step 7.4 For each child child of nodes shadow root, in tree order: append the result of
// cloning child with document and the clone children flag set, to copys shadow root.