[whatwg] add <content> and <shadow> to the HTML spec?

Michael[tm] Smith mike at w3.org
Tue Jul 2 01:42:01 PDT 2013


The <content> and <shadow> elements are new HTML elements that are
currently defined in the Shadow DOM spec. The spec definitions for them
seem to be fairly stable now, and they're implemented in Chromium/Blink,
though not yet in other browsers (though there's at least already a Gecko
patch for <content> so far).

  https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#shadow-element
  https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#content-element

Since they are elements in the HTML namespace that look likely to actually
have a chance of eventually becoming part of the Web platform, it seems
worthwhile to consider adding them to the HTML spec itself now.

I don't know if it's practical/useful to actually try to define the
<shadow> and <content> elements in the HTML spec without also defining the
entire Shadow DOM mechanism in the HTML spec too. But if it is practical,
maybe just the essentials of the elements could be defined in the HTML
spec, and then the HTML spec could normatively reference the Shadow DOM
spec for the detailed requirements of the UA behavior of the elements.

Both elements are non-void elements, and as far as I know neither of them
has any special effect on parsing that would require changes to the HTML
parsing algorithm.

Below are attempts at listing out just the essentials of the <content> and
<shadow> elements that could be defined in the HTML spec (with normative
references to terms in the Shadow DOM spec in quotation marks):

-----------------
<content> element
-----------------
The <content> element indicates an Shadow DOM "insertion point" to which
the children of a "shadow host" are inserted into a "shadow tree".
(A "shadow host" is an element whose child contents are not rendered
directly; instead an associated "shadow tree" is rendered in place of the
element's child contents, with the <content> element being used to indicate
where, in the shadow tree, to insert the original child contents of the
shadow-host element.)

  https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#dfn-insertion-point
  https://dvcs.w3.org/hg/webcomponents/raw-file/tip/explainer/index.html#insertion-points

Contexts in which this element can be used: Where flow content is expected.

Content model: Transparent

Content attributes:

 - boolean "resetstyleinheritance" attribute that indicates the state of
   the "reset-style-inheritance" flag for the Shadow DOM insertion point
   that this <content> element defines

 - "select" attribute whose value is a set of comma-separated tokens, each
   of which must be a compound selector

DOM Interface:
see https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#content-element)

HTMLContentElement interface, with "resetStyleInheritance" and "select" IDL
attributes that reflect the content attributes, and a getDistributedNodes()
method that returns a NodeList of the nodes that have been "distributed"
into the insertion point that this element defines.

----------------
<shadow> element
----------------
The <shadow> element indicates an Shadow DOM "shadow insertion point" in a
"shadow tree" into which a previously-applied shadow tree is inserted. (A
"shadow tree" is DOM tree that's rendered in place of the child contents of
a "shadow host" whose child contents are not rendered directly.)

  https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#dfn-shadow-insertion-point
  https://dvcs.w3.org/hg/webcomponents/raw-file/tip/explainer/index.html#multiple-shadow-subtrees

Contexts in which this element can be used: Where flow content is expected.

Content model: Transparent

Content attributes:

 - boolean "resetstyleinheritance" attribute that indicates the state of
   the "reset-style-inheritance" flag for the Shadow DOM "shadow insertion
   point" that this <shadow> element defines

DOM Interface:
  see https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#content-element)

HTMLShadowElement interface, with a "resetStyleInheritance" IDL attributes
that reflects the content attribute, and an "olderShadowRoot" attribute
that returns the "shadow tree" to render in place of the "shadow insertion
point" that this <shadow> element defines.

-----

As I said, the above are just the minimum that I think the HTML spec could
define for <content> and <shadow>, while normatively referring to the
Shadow DOM spec for the behavioral requirements.

  --Mike
-- 
Michael[tm] Smith http://people.w3.org/mike


More information about the whatwg mailing list