From 817f94bfbac106f020ecfc0d0be4b9dd7ab671f1 Mon Sep 17 00:00:00 2001
From: Mason Freed Run any cloning steps defined for node in
other applicable specifications and pass copy, node,
- document and the clone children flag if set, as parameters.
+ document, and the clone children flag if set, as parameters.
- If the clone children flag is set, then for each child
+ child of node, in tree order: append the result of
+ cloning child with document and the
+ clone children flag set, to copy.
- If node is a shadow host whose shadow root's
+ clonable is true:
+
+ Run attach a shadow root with copy, node's
+ shadow root's mode, true, node's
+ shadow root's delegates focus, and node's
+ shadow root's slot assignment.
+
+ Set copy's shadow root's declarative
+ to node's shadow root's declarative.
+
+ If the clone children flag is set, then for each child
+ child of node's shadow root, in tree order:
+ append the result of cloning child with
+ document and the clone children flag set, to copy's
+ shadow root.
+ Return copy.
The A document is said to be an XML document if its type
is " Shadow roots have an associated
available to element internals. It is initially set to false. Shadow roots have an associated declarative
+(a boolean). It is initially set to false. Shadow roots's associated host is never null.
+
+
+ cloneNode(deep)
method steps are:
@@ -4973,8 +4994,9 @@ known as documents.
content type (a string),
URL (a URL),
origin (an origin),
-type ("xml
" or "html
"), and
-mode ("no-quirks
", "quirks
", or "limited-quirks
").
+type ("xml
" or "html
"),
+mode ("no-quirks
", "quirks
", or "limited-quirks
"), and
+allow declarative shadow roots (a boolean).
[[!ENCODING]]
[[!URL]]
[[!HTML]]
@@ -4983,8 +5005,8 @@ known as documents.
encoding, content type is
"application/xml
", URL is "about:blank
",
origin is an opaque origin,
-type is "xml
", and its
-mode is "no-quirks
".
+type is "xml
", mode is "no-quirks
",
+and allow declarative shadow roots is false.
xml
"; otherwise an HTML document. Whether a document is an
@@ -5857,6 +5879,9 @@ It is initially set to false.
Shadow roots have an associated slot assignment
("manual
" or "named
").
+
Shadow roots have an associated clonable (a boolean). +It is initially set to false.
+A shadow root's get the parent algorithm, given an event, returns
null if event's composed flag is unset and shadow root is the
root of event's path's first struct's
@@ -6010,6 +6038,7 @@ dictionary ShadowRootInit {
required ShadowRootMode mode;
boolean delegatesFocus = false;
SlotAssignmentMode slotAssignment = "named";
+ boolean clonable = false;
};
@@ -6857,23 +6886,38 @@ are:
"span
"
+
The attachShadow(init)
method steps are:
If this's namespace is not the HTML namespace, +
Run attach a shadow root with this, init["{{ShadowRootInit/mode}}"], + init["{{ShadowRootInit/clonable}}"], init["{{ShadowRootInit/delegatesFocus}}"], + and init["{{ShadowRootInit/slotAssignment}}"]. + +
Return this's shadow root. +
To attach a shadow root, given an +element element, a string mode, a boolean clonable, +a boolean delegatesFocus, and a boolean slotAssignment: + +
If element's namespace is not the HTML namespace, then throw a "{{NotSupportedError!!exception}}" {{DOMException}}.
If this's local name is not a valid shadow host name, then throw a "{{NotSupportedError!!exception}}" {{DOMException}}.
If this's local name is a valid custom element name, or
- this's is
value is not null, then:
+
If element's local name is a valid custom element name, or
+ element's is
value is non-null, then:
Let definition be the result of
looking up a custom element definition given
- this's node document, its namespace, its
+ element's node document, its namespace, its
local name, and its is
value.
If definition is not null and definition's @@ -6882,38 +6926,52 @@ are:
If this is a shadow host, then throw an - "{{NotSupportedError!!exception}}" {{DOMException}}. +
If element is a shadow host, then: + +
If element's shadow root's declarative + is false, then throw an "{{NotSupportedError!!exception}}" {{DOMException}}. + +
Otherwise, remove all of element's + shadow root's children, in tree order, and return. + +
This means that if multiple declarative shadow roots are contained within a single + shadow host, only the last one will remain. +
Let shadow be a new shadow root whose node document - is this's node document, host is this, - and mode is init["{{ShadowRootInit/mode}}"]. + is element's node document, host is + element, and mode is mode. -
Set shadow's delegates focus to - init["{{ShadowRootInit/delegatesFocus}}"]. +
Set shadow's delegates focus to delegatesFocus.
If this's custom element state is "precustomized
" or
"custom
", then set shadow's
available to element internals to true.
-
Set shadow's slot assignment to - init["{{ShadowRootInit/slotAssignment}}"]. +
Set shadow's slot assignment to slotAssignment. -
Set this's shadow root to shadow. +
Set shadow's declarative to false. -
Return shadow. +
Set shadow's clonable to clonable. + +
Set element's shadow root to shadow.
The shadowRoot
getter steps are:
Let shadow be this's shadow root.
If shadow is null or its mode is "closed
",
- then return null.
Return shadow.
application/xml
", URL is "about:blank
",
origin is an opaque origin,
-type is "xml
", mode is "no-quirks
",
-and allow declarative shadow roots is false.
+type is "xml
", mode is
+"no-quirks
", and its allow declarative shadow roots is false.
A document is said to be an XML document if its type
is "xml
"; otherwise an HTML document. Whether a document is an
@@ -6890,9 +6890,10 @@ are:
The attachShadow(init)
method steps are:
Run attach a shadow root with this, init["{{ShadowRootInit/mode}}"], - init["{{ShadowRootInit/clonable}}"], init["{{ShadowRootInit/delegatesFocus}}"], - and init["{{ShadowRootInit/slotAssignment}}"]. +
Run attach a shadow root with this, + init["{{ShadowRootInit/mode}}"], init["{{ShadowRootInit/clonable}}"], + init["{{ShadowRootInit/delegatesFocus}}"], and + init["{{ShadowRootInit/slotAssignment}}"].
Return this's shadow root.
If element's namespace is not the HTML namespace, then throw a "{{NotSupportedError!!exception}}" {{DOMException}}. -
If this's local name is not a valid shadow host name, then - throw a "{{NotSupportedError!!exception}}" {{DOMException}}. +
If element's is not a valid shadow host name, then throw a + "{{NotSupportedError!!exception}}" {{DOMException}}.
If element's local name is a valid custom element name, or @@ -6933,11 +6934,12 @@ a boolean delegatesFocus, and a boolean slotAssignment:
If element's shadow root's declarative is false, then throw an "{{NotSupportedError!!exception}}" {{DOMException}}. -
Otherwise, remove all of element's - shadow root's children, in tree order, and return. +
Otherwise, remove all of element's shadow root's + children, in tree order, and return. -
This means that if multiple declarative shadow roots are contained within a single - shadow host, only the last one will remain. +
This means that if multiple declarative shadow roots are contained within a single + shadow host, only the last one will remain.
Let shadow be a new shadow root whose node document @@ -6946,8 +6948,8 @@ a boolean delegatesFocus, and a boolean slotAssignment:
Set shadow's delegates focus to delegatesFocus. -
If this's custom element state is "precustomized
" or
- "custom
", then set shadow's
+
If element's custom element state is
+ "precustomized
" or "custom
", then set shadow's
available to element internals to true.
Set shadow's slot assignment to slotAssignment.
From 17ede93b019cb319c9b786dfce950c2ba17ec3c3 Mon Sep 17 00:00:00 2001
From: Anne van Kesteren Otherwise, remove all of element's shadow root's
- children, in tree order, and return.
+ children, in tree order, and return.
This means that if multiple declarative shadow roots are contained within a single
shadow host, only the last one will remain.