diff --git a/dom.bs b/dom.bs index 616a18340..bf651d4e3 100644 --- a/dom.bs +++ b/dom.bs @@ -3568,7 +3568,7 @@ dom-Range-extractContents, dom-Range-cloneContents --> invoked, must run these steps:
If context object is a shadow root, throw a {{NotSupportedError}} +
If context object is a shadow root, throw a {{NotSupportedError}} exception.
Return a clone of the context object, with the @@ -4537,7 +4537,7 @@ method, when invoked, must run these steps: deep is true, the copy also includes the node's descendants. - If node is a document or a shadow root, throws a + If node is a document or a shadow root, throws a {{NotSupportedError}} exception.
importNode(node, deep)
method,
when invoked, must run these steps:
The {{DocumentFragment}} node's host -concept is useful for HTML's <{template}> element and for shadow roots, and impacts the +concept is useful for HTML's <{template}> element and for shadow roots, and impacts the pre-insert and replace algorithms.
{{ShadowRoot}} nodes are simply known as -shadow roots. +shadow roots. + +
Shadow roots have an associated encapsulation mode
+("open
" or "closed
").
The host
attribute's getter must return the
context object's host.
@@ -5027,6 +5030,9 @@ interface Element : Node {
Attr? setAttributeNodeNS(Attr attr);
Attr removeAttributeNode(Attr attr);
+ ShadowRoot attachShadow(ShadowRootInit init);
+ readonly attribute ShadowRoot? shadowRoot;
+
Element? closest(DOMString selectors);
boolean matches(DOMString selectors);
boolean webkitMatchesSelector(DOMString selectors); // historical alias of .matches
@@ -5037,22 +5043,29 @@ interface Element : Node {
Element? insertAdjacentElement(DOMString where, Element element); // historical
void insertAdjacentText(DOMString where, DOMString data); // historical
-};
+};
+dictionary ShadowRootInit {
+ required ShadowRootMode mode;
+};
-{{Element}} nodes are simply
-known as elements.
+enum ShadowRootMode { "open", "closed" };
+
+
+
{{Element}} nodes are simply known as +elements. -Elements have an associated +
Elements have an associated namespace, namespace prefix, and local name. When an -element is created, its -local name is always given. -Unless explicitly given when an element -is created, its namespace and -namespace prefix are -null. +element is created, its local name is always given. Unless +explicitly given when an element is created, its namespace and +namespace prefix are null. + +
Elements also have an associated +shadow root (null or a +shadow root). Null unless otherwise stated.
An element's qualified name is its local name if its namespace prefix is null, and its @@ -5572,6 +5585,68 @@ method, when invoked, must run these steps:
var shadow = element . {{attachShadow(init)}}
+ Creates a shadow root for element and returns it. + +
var shadow = element . {{shadowRoot}}
+ Returns element's shadow root, if any, and if
+ shadow root's encapsulation mode is "open
", and
+ null otherwise.
+
The attachShadow(init)
method, when
+invoked, must run these steps:
+
+
If context object is not a custom element, and is not an
+ element whose namespace is the HTML namespace and
+ local name is
+ "article
",
+ "aside
",
+ "blockquote
",
+ "body
",
+ "div
",
+ "footer
",
+ "h1
",
+ "h2
",
+ "h3
",
+ "h4
",
+ "h5
",
+ "h6
",
+ "header
",
+ "nav
",
+ "p
",
+ "section
", or
+ "span
", then throw a {{NotSupportedError}} exception.
+
+
If context object's shadow root is non-null, then throw a + {{InvalidStateError}} exception. + +
Let shadow be a new shadow root whose node document is + context object's node document, host is + context object, and encapsulation mode is init's + {{ShadowRootInit/mode}}. + +
Set context object's shadow root to shadow. + +
Return shadow. +
The shadowRoot
attribute's getter must run these
+steps:
+
+
Let shadow be context object's shadow root. + +
If shadow is null or its encapsulation mode is
+ "closed
", then return null.
+
+
Return shadow. +
element . {{closest(selectors)}}
ShadowRoot
nodes are simply known as shadow roots.
ShadowRoot
nodes are simply known as shadow roots.
Shadow roots have an associated encapsulation mode ("open
" or "closed
").
The host
attribute’s getter must return the context object’s host.
For now you can find more information about this object in Shadow DOM. The DOM Standard will be updated over time to cover more details.
@@ -2793,6 +2794,9 @@Element
nodes are simply
-known as elements.
Elements have an associated namespace, namespace prefix, and local name. When an element is created, its local name is always given. -Unless explicitly given when an element is created, its namespace and namespace prefix are -null.
+}; + +dictionary ShadowRootInit { + required ShadowRootMode mode; +}; + +enum ShadowRootMode { "open", "closed" }; + +Element
nodes are simply known as elements.
Elements have an associated namespace, namespace prefix, and local name. When an element is created, its local name is always given. Unless +explicitly given when an element is created, its namespace and namespace prefix are null.
+Elements also have an associated shadow root (null or a shadow root). Null unless otherwise stated.
An element’s qualified name is its local name if its namespace prefix is null, and its namespace prefix, followed by ":
", followed by its local name, otherwise.
User agents could have this as an internal slot as an optimization, but are not required to do so. The standard has this concept for readability.
@@ -3059,6 +3069,58 @@var shadow = element . attachShadow(init)
+ Creates a shadow root for element and returns it.
+var shadow = element . shadowRoot
+ Returns element’s shadow root, if any, and if shadow root’s encapsulation mode is "open
", and
+ null otherwise.
The attachShadow(init)
method, when
+invoked, must run these steps:
If context object is not a custom element, and is not an element whose namespace is the HTML namespace and local name is
+ "article
",
+ "aside
",
+ "blockquote
",
+ "body
",
+ "div
",
+ "footer
",
+ "h1
",
+ "h2
",
+ "h3
",
+ "h4
",
+ "h5
",
+ "h6
",
+ "header
",
+ "nav
",
+ "p
",
+ "section
", or
+ "span
", then throw a NotSupportedError
exception.
If context object’s shadow root is non-null, then throw a InvalidStateError
exception.
Let shadow be a new shadow root whose node document is context object’s node document, host is context object, and encapsulation mode is init’s mode
.
Set context object’s shadow root to shadow.
+Return shadow.
+The shadowRoot
attribute’s getter must run these
+steps:
Let shadow be context object’s shadow root.
+If shadow is null or its encapsulation mode is
+ "closed
", then return null.
Return shadow.
+element . closest(selectors)