From 4a49204fcf129b01686da04d80216d0c47452771 Mon Sep 17 00:00:00 2001 From: Hayato Ito Date: Tue, 10 Jan 2017 14:30:34 +0900 Subject: [PATCH] Downstream "ShadowRoot interface" from DOM Standard (#377) --- spec/shadow/index.html | 84 ++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/spec/shadow/index.html b/spec/shadow/index.html index c8f39b05..c80da1a6 100644 --- a/spec/shadow/index.html +++ b/spec/shadow/index.html @@ -1003,37 +1003,53 @@

Extensions to the Interface ShadowRoot

-
- -
readonly attribute Element host
-
-

Represents the shadow host which hosts the context object.

-

On getting, the attribute must return the shadow host which hosts the context object.

-
- -
[TreatNullAs=EmptyString] attribute DOMString innerHTML
-
- This is similarly defined in Element's innerHTML with the following exceptions: - - -

- Because DocumentFragment does not always have a host, innerHTML can not be defined in DocumentFragment. -

-
-
- -

The nodeType attribute of a ShadowRoot instance must return DOCUMENT_FRAGMENT_NODE. Accordingly, the nodeName attribute of a ShadowRoot instance must return "#document-fragment".

+

+ This section is a copy of Interface ShadowRoot section in [[WHATWG-DOM]]. This section is expected to be synced with that periodically. +

+ +
[Exposed=Window]
+interface ShadowRoot : DocumentFragment {
+  readonly attribute ShadowRootMode mode;
+  readonly attribute Element host;
+};
+
+enum ShadowRootMode { "open", "closed" };
+
+

ShadowRoot nodes are simply known as shadow roots.

+

Shadow roots have an associated mode ("open" +or "closed").

+

Shadow roots’s associated host is never null.

+

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 tuple’s item, and shadow root’s host otherwise.

+

The mode attribute’s getter must return the context object’s mode.

+

The host attribute’s getter must return the context object’s host.

+
+

In shadow-including tree order, is shadow-including preorder, depth-first traversal of a node tree. shadow-including preorder, depth-first traversal of a node tree tree is preorder, depth-first traversal of tree, with for each shadow host encountered in tree, shadow-including preorder, depth-first traversal of that element’s shadow root’s node tree just after it is encountered.

+

The shadow-including root of an object is its root’s host’s shadow-including root, if the +object’s root is a shadow root, and its root otherwise.

+

An object A is a shadow-including descendant of an object B, if A is a descendant of B, or A’s root is a shadow root and A’s root’s host is a shadow-including inclusive descendant of B.

+

A shadow-including inclusive descendant is an object or one of its shadow-including descendants.

+

An object A is a shadow-including ancestor of an object B, if and only if B is a shadow-including descendant of A.

+

A shadow-including inclusive ancestor is an object or one of its shadow-including ancestors.

+

A node A is closed-shadow-hidden from a node B if all of the following conditions are true:

+ +

To retarget an object A against an object B, repeat these steps until they return an object:

+
    +
  1. +

    If A’s root is not a shadow root, or A’s root is a shadow-including inclusive ancestor of B, then return A.

    +
  2. +

    Set A to A’s root’s host.

    +
@@ -1117,16 +1133,6 @@

ShadowRootInit dictionary

-
-

ShadowRootMode enum

-
-
open
-
Specifies "open" mode
-
closed
-
Specifies "closed" mode
-
-
-

Extensions to Text Interface