<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rolandsteiner</id>
	<title>WHATWG Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.whatwg.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rolandsteiner"/>
	<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/wiki/Special:Contributions/Rolandsteiner"/>
	<updated>2026-04-29T18:46:16Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7873</id>
		<title>Component Model Discussion: Rendering</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7873"/>
		<updated>2012-01-12T02:40:42Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Rendering */ fix some copy/paste typos&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The question asked herein is how to best treat the following somewhat mutually exclusive requirements:&lt;br /&gt;
&lt;br /&gt;
[1] The containing document &amp;quot;wants&amp;quot; to naturally style the host element (using &amp;lt;x-foo&amp;gt; notation here - see the [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Registration Component Registration page] for alternatives). E.g.,&lt;br /&gt;
&lt;br /&gt;
  x-foo {&lt;br /&gt;
      background-color: yellow;&lt;br /&gt;
      border: 1px solid blue;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
[2] The component &amp;quot;wants&amp;quot; to be able to style its outermost rendering rectangle. Because of [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Isolation Isolation], this rectangle is ideally located within the component, i.e., within the shadow DOM.&lt;br /&gt;
&lt;br /&gt;
and as a somewhat lesser concern:&lt;br /&gt;
&lt;br /&gt;
[3] Every point between the rectangles should correspond to a valid DOM range.&lt;br /&gt;
&lt;br /&gt;
ad [3]: Note that conversely, in no variant there is a mapping from a DOM range with anchor &amp;lt;x-foo&amp;gt; to a rectangle/screen position, since the children of &amp;lt;x-foo&amp;gt; may be rendered in arbitrary places, depending on &amp;lt;content&amp;gt; elements within the shadow DOM, or even not at all.&lt;br /&gt;
&lt;br /&gt;
== Rendering ==&lt;br /&gt;
&lt;br /&gt;
This consists of the following, more or less orthogonal, sub-questions&lt;br /&gt;
&lt;br /&gt;
* is the host element rendered or not?&lt;br /&gt;
* is the shadow root rendered or not?&lt;br /&gt;
* is the shadow root an element or a separate node type?&lt;br /&gt;
* using &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
Almost all combinations of the above have their respective merits and problems. Assume we have the following DOM structure:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;A&amp;gt;&lt;br /&gt;
    &amp;lt;x-foo&amp;gt; -----&amp;gt; [ShadowRoot (S)]&lt;br /&gt;
      &amp;lt;B/&amp;gt;            &amp;lt;Y/&amp;gt;&lt;br /&gt;
      &amp;lt;C/&amp;gt;            &amp;lt;Z/&amp;gt;&lt;br /&gt;
      &amp;lt;D/&amp;gt;&lt;br /&gt;
    &amp;lt;/x-foo&amp;gt;&lt;br /&gt;
  &amp;lt;/A&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This could conceivably be rendered in the following ways:&lt;br /&gt;
&lt;br /&gt;
=== [A] rendered host element, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------------------------------------+&lt;br /&gt;
  |       x-foo-------------------------------------------------+       |&lt;br /&gt;
  |       |       SR------------------------------------+       |       |&lt;br /&gt;
  |       |       |       Y------+       Z------+       |       |       |&lt;br /&gt;
  | [A,0] |  ???  | [S,0] |      | [S,1] |      | [S,2] |  ???  | [A,1] |&lt;br /&gt;
  |       |       |       +------+       +------+       |       |       |&lt;br /&gt;
  |       |       +-------------------------------------+       |       |&lt;br /&gt;
  |       +-----------------------------------------------------+       |&lt;br /&gt;
  +---------------------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Styles set on &amp;lt;x-foo&amp;gt; such as &amp;lt;code&amp;gt;background-color&amp;lt;/code&amp;gt; don&#039;t really affect the component&#039;s rendering if the component overrides them on the shadow root.&lt;br /&gt;
* The potential gaps between the shadow root&#039;s rectangle and the outer host element&#039;s rectangle don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [B] rendered host element with default &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  |       :SR------------------------------------+:       |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  | [A,0] :| [S,0] |      | [S,1] |      | [S,2] |: [A,1] |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  |       :+-------------------------------------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [A], with the associated issues.&lt;br /&gt;
&lt;br /&gt;
=== [C] rendered host element, rendered shadow root, shadow root is separate node type, shadow root&#039;s rectangle always is the same as the host element&#039;s (no gap) ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo-----------------------------------+       |&lt;br /&gt;
  |       |SR------------------------------------+|       |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  | [A,0] || [S,0] |      | [S,1] |      | [S,2] || [A,1] |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  |       |+-------------------------------------+|       |&lt;br /&gt;
  |       +---------------------------------------+       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
This allows both the document to style &amp;lt;x-foo&amp;gt;, as well as allowing the component to have its own outer rectangle, but prevents any gap from forming between them. However, this raises more questions than it answers:&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Need to spec how ShadowRoot node type is styleable&lt;br /&gt;
* &amp;lt;code&amp;gt;margin&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;padding&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;position&amp;lt;/code&amp;gt; et al must not apply, so need to define how styles apply to ShadowRoot in detail.&lt;br /&gt;
&lt;br /&gt;
=== [D] rendered host element, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       x-foo---------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] |  ???  |      |  ???  |      |  ???  | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Confinement requires separate style-sheet in order for the component to be able to style the host element.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [E] host element has &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt; by default, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - +       |&lt;br /&gt;
  |       :Y------+       Z------+:       |&lt;br /&gt;
  |  ???  :|      |  ???  |      |:  ???  |&lt;br /&gt;
  |       :+------+       +------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - +       |&lt;br /&gt;
  +---------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [D], with the associated issues.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [F] host element not rendered, rendered shadow root ===&lt;br /&gt;
&lt;br /&gt;
In this scenario, the ShadowRoot most likely is an element.&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       SR------------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] | [S,0] |      | [S,1] |      | [S,2] | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host. Because of Isolation it also can&#039;t style the ShadowRoot, unless styles styles set on &amp;amp;lt;x-foo&amp;amp;gt; are forwarded somehow. If so, mechanism of style forwarding needs to be specced.&lt;br /&gt;
&lt;br /&gt;
=== [F2] neither host element nor shadow root rendered, shadow root has single child &amp;amp;lt;R&amp;amp;gt; as root element ===&lt;br /&gt;
&lt;br /&gt;
Similar to [F], but the ShadowRoot doesn&#039;t have to be an element itself, can be extended towards [G] later on.&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       R-------------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] | [R,0] |      | [R,1] |      | [R,2] | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host. Because of Isolation it also can&#039;t style the ShadowRoot nor the shadow root element, unless styles styles set on &amp;amp;lt;x-foo&amp;amp;gt; are forwarded somehow. If so, mechanism of style forwarding needs to be specced.&lt;br /&gt;
&lt;br /&gt;
=== [G] neither host element nor shadow root rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------+&lt;br /&gt;
  |       Y------+       Z------+       |&lt;br /&gt;
  |  ???  |      |  ???  |      |  ???  |&lt;br /&gt;
  |       +------+       +------+       |&lt;br /&gt;
  +-------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Undoubtedly the most flexible from a layout perspective, as it allows a single element to &amp;quot;create&amp;quot; multiple renderers.&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* There is no single rendering rectangle corresponding to &amp;lt;x-foo&amp;gt;.&lt;br /&gt;
* Containing document can&#039;t style the host element. Styles set on &amp;lt;x-foo&amp;gt; could be forwarded to ALL children of the shadow root, but it&#039;s not clear this is useful.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the host element&#039;s parent don&#039;t directly map to a DOM position.&lt;br /&gt;
&lt;br /&gt;
=== [Z] Other? ===&lt;br /&gt;
&lt;br /&gt;
There is a marvelous variant that solves all issues and doesn&#039;t suffer any of the above drawbacks which this paragraph is too small to contain.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
Currently we implemented variant [D].&lt;br /&gt;
&lt;br /&gt;
We probably want to go towards [F2].&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Use_Cases&amp;diff=7548</id>
		<title>Component Model Use Cases</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Use_Cases&amp;diff=7548"/>
		<updated>2011-11-02T16:41:20Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Custom Controls */ Add &amp;quot;entry-helper&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These use cases represent a set of problems we are trying to solve by implementing a [[Component_Model | component model]] for the web. &lt;br /&gt;
&lt;br /&gt;
=Custom Controls=&lt;br /&gt;
&lt;br /&gt;
Current practice for sizable web applications is to use JavaScript libraries to provide a system to support the construction of custom controls. Implementing these controls can be made simpler and more interoperable with runtime support.&lt;br /&gt;
&lt;br /&gt;
==Layout Manager==&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;8&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+style=&amp;quot;caption-side:top; text-align: left; color:Gray&amp;quot; | Layout Manager Use Case Parameters&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Who&lt;br /&gt;
| Web Framework Engineer&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | What&lt;br /&gt;
| Build a layout library, consisting of a UI layout primitives, such as &#039;&#039;panel&#039;&#039;, &#039;&#039;resizeable panel&#039;&#039;, &#039;&#039;tab group&#039;&#039;, &#039;&#039;stack&#039;&#039;, &#039;&#039;accordion containers&#039;&#039;, etc.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Purpose&lt;br /&gt;
|&lt;br /&gt;
* Allow web application developers to easily build constrained layout and populate it with arbitrary HTML content.&lt;br /&gt;
* Provide a way for developers to build their own layout primitives by extending the provided ones.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Examples&lt;br /&gt;
|&lt;br /&gt;
* [http://dojotoolkit.org/reference-guide/dijit/layout.html#dijit-layout Dijit Layout]&lt;br /&gt;
* [http://code.google.com/webtoolkit/doc/latest/DevGuideUiPanels.html GWT Panels]&lt;br /&gt;
* [http://dev.sencha.com/deploy/ext-4.0.2a/docs/#/api/Ext.panel.AbstractPanel Sencha Panels]&lt;br /&gt;
* [http://guides.sproutcore.com/views.html SproutCore Views]&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Desirable Properties&lt;br /&gt;
|&lt;br /&gt;
* [[Component_Model#Composability | Composability]] -- a method to compose layouts with both UI primitives and DOM elements.&lt;br /&gt;
* [[Component_Model#Extensibility | Extensibility]] -- a way to build on layout primitives to create new ones.&lt;br /&gt;
* [[Component_Model#Encapsulation | Encapsulation]] -- styles, defined to hold layout in place should not be in danger of being stomped on by the author stylesheets.&lt;br /&gt;
* [[Component_Model#Performance | Performance]] -- layouts built with layout manager should appear quickly, avoiding re-flows and [http://en.wikipedia.org/wiki/Flash_of_unstyled_content FOUC]-like symptoms.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Widget Mix-and-Match==&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;8&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ style=&amp;quot;caption-side:top; text-align: left; color:Gray&amp;quot; | Mix-and-matching Use Case Parameters&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Who&lt;br /&gt;
| Web Application Engineer&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | What&lt;br /&gt;
| Build an application using multiple existing controls from several frameworks.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Purpose&lt;br /&gt;
|&lt;br /&gt;
* Write application faster by reusing code.&lt;br /&gt;
* Avoid having to exclusively go with one framework.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Examples&lt;br /&gt;
|&lt;br /&gt;
* [http://stackoverflow.com/questions/4534274/how-do-you-access-dijit-elements-in-jquery How do you access Dijit elements in JQuery]&lt;br /&gt;
* [http://yehudakatz.com/2011/06/11/using-sproutcore-2-0-with-jquery-ui/ Using SproutCore 2.0 with jQuery UI]&lt;br /&gt;
* [http://stackoverflow.com/questions/394601/which-javascript-framework-jquery-vs-dojo-vs Which JavaScript framework (jQuery vs Dojo vs … )?]&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Desirable Properties&lt;br /&gt;
|&lt;br /&gt;
* [[Component_Model#Consistency | Consistency]] -- a compatible way to expose properties and methods across widget frameworks.&lt;br /&gt;
* [[Component_Model#Composability | Composability]] -- a method to compose with cross-framework widgets.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Rendering Form Controls with SVG==&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;8&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ style=&amp;quot;caption-side:top; text-align: left; color:Gray&amp;quot; | SVG Form Controls Use Case Parameters&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Who&lt;br /&gt;
| Web Application Engineer or Web Framework Engineer&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | What&lt;br /&gt;
| Create a set of UI controls that act like standard HTML forms controls, but use SVG for rendering.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Purpose&lt;br /&gt;
|&lt;br /&gt;
* Provide custom appearance of form controls, consistent with overall the Web application theme.&lt;br /&gt;
* Make the form controls scale beautifully for various resolutions and form factors. &lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Examples&lt;br /&gt;
|&lt;br /&gt;
[http://docs.sproutcore.com/#doc=SC.ImageButtonView&amp;amp;src=false SproutCore&#039;s ImageButtonView], [http://dev.sencha.com/deploy/touch/docs/?class=Ext.form.Number Sencha&#039;s Number] -- examples of extensive themed form control hierarchy.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Desirable Properties&lt;br /&gt;
|&lt;br /&gt;
* [[Component_Model#Consistency | Consistency]] -- the controls should act just like any other DOM elements.&lt;br /&gt;
* [[Component_Model#Encapsulation | Encapsulation]] -- the document shouldn&#039;t be able to accidentally mess up the rendering of the controls.&lt;br /&gt;
* [[Component_Model#Performance | Performance]] -- load quickly, avoid [http://en.wikipedia.org/wiki/Flash_of_unstyled_content FOUC]-like symptoms when using controls.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Contacts Widget==&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;8&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ style=&amp;quot;caption-side:top; text-align: left; color:Gray&amp;quot; | Contacts Widget Use Case Parameters&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Who&lt;br /&gt;
| Web Application Engineer&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | What&lt;br /&gt;
| Build a drop-in Contacts widget, which has a pre-defined appearance and shows a list of your contacts, with a way to change the widget to compact or full view and to tell the widget to refresh its state.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Purpose&lt;br /&gt;
|&lt;br /&gt;
* Use the widget anywhere in the application without having to worry about styles affecting its appearance.&lt;br /&gt;
* Hide details of loading contact data and other plumbing of the widget from the consuming code with a stable API.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Examples&lt;br /&gt;
| [http://i.imgur.com/4eDXM.png A screenshot of Google+ &amp;quot;in your circles&amp;quot; widget]&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Desirable Properties&lt;br /&gt;
|&lt;br /&gt;
* [[Component_Model#Encapsulation | Encapsulation]] -- means to ensure style of the document does not affect the widget, and widget&#039;s logic is kept to the widget.&lt;br /&gt;
* [[Component_Model#Composability | Composability]] -- easily added anywhere in the DOM tree.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Like/+1 Button==&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;8&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ style=&amp;quot;caption-side:top; text-align: left; color:Gray&amp;quot; | Like/+1 Button Use Case Parameters&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Who&lt;br /&gt;
| Web Application Engineer&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | What&lt;br /&gt;
| Build a drop-in widget with a pre-defined appearance of a button, showing a count of likes/+1s for this instance of a button (count is stored at a central location), embeddable on any document on the Web.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Purpose&lt;br /&gt;
|&lt;br /&gt;
* Provide a simple vehicle for Web authors to embed the button.&lt;br /&gt;
* Isolate widget implementation details from the document.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Examples&lt;br /&gt;
|&lt;br /&gt;
* [http://developers.facebook.com/docs/reference/plugins/like/ Facebook Like button embedding instructions]&lt;br /&gt;
* [http://www.google.com/webmasters/+1/button/ Google +1 button embedding instructions]&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Desirable Properties&lt;br /&gt;
|&lt;br /&gt;
* [[Component_Model#Encapsulation | Encapsulation]] -- means to ensure style of the document does not affect the widget, and widget&#039;s logic is kept to the widget.&lt;br /&gt;
* [[Component_Model#Confinement | Confinement]] -- a way to completely isolate the widget implementation from the document in which it is being embedded.&lt;br /&gt;
* [[Component_Model#Performance | Performance]] -- don&#039;t block the page load.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Table-based Charts==&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;8&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ style=&amp;quot;caption-side:top; text-align: left; color:Gray&amp;quot; | Table-based Charts Use Case Parameters&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Who&lt;br /&gt;
| Web Framework Engineer&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | What&lt;br /&gt;
| Provide a way to represent table data markup as charts or diagrams.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Purpose&lt;br /&gt;
| Make it easy for Web authors to create charts and diagrams using table markup.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Examples&lt;br /&gt;
|&lt;br /&gt;
* [http://www.wait-till-i.com/2008/01/08/generating-charts-from-accessible-data-tables-using-the-google-charts-api/ Christian Heilmann&#039;s tochart script]&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Desirable Properties&lt;br /&gt;
|&lt;br /&gt;
* [[Component_Model#Composability | Composability]] -- one should be able to make chart by creating a table, imperatively or declaratively.&lt;br /&gt;
* [[Component_Model#Performance | Performance]] -- no FOUC or blocking load when charts are loaded.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Timezone selection via Image==&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;8&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ style=&amp;quot;caption-side:top; text-align: left; color:Gray&amp;quot; | Timezone selection via Image Use Case Parameters&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Who&lt;br /&gt;
| Web Framework Engineer&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | What&lt;br /&gt;
| Graphical representation of a timezone selector that shows a world map in addition to/instead of a drop-down list.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Purpose&lt;br /&gt;
| Make it easy for Web authors to spruce up time zone selection (or similar).&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Examples&lt;br /&gt;
|&lt;br /&gt;
* [http://www.timezonecheck.com Time Zone Map]&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Desirable Properties&lt;br /&gt;
|&lt;br /&gt;
* [[Component_Model#Extensibility | Extensibility]] -- Basically extending &amp;amp;lt;select&amp;amp;gt;. Should fall back to a simple &amp;amp;lt;select&amp;amp;gt; where components are not supported.&lt;br /&gt;
* [[Component_Model#Consistency | Consistency]] -- Extend the &amp;amp;lt;select&amp;amp;gt; API for item selection.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Entry-helper==&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;8&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ style=&amp;quot;caption-side:top; text-align: left; color:Gray&amp;quot; | Entry-helper Use Case Parameters&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Who&lt;br /&gt;
| Web Framework Engineer, Web Application Engineer&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | What&lt;br /&gt;
| Add an entry-helper (drop-down) list to input fields.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Purpose&lt;br /&gt;
| &lt;br /&gt;
Help the user fill in a form field, show suggestions and acceptable values, speed up data entry.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Examples&lt;br /&gt;
| &lt;br /&gt;
* Most browser&#039;s address bar or web search field &lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Desirable Properties&lt;br /&gt;
|&lt;br /&gt;
* [[Component_Model#Extensibility | Extensibility]] -- Basically extending &amp;amp;lt;input&amp;amp;gt;. Should fall back to a simple &amp;amp;lt;input&amp;amp;gt; where components are not supported.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Built-in HTML Elements=&lt;br /&gt;
&lt;br /&gt;
Many non-trivial (i.e. with additional behavior and styling beyond the standard box model) elements that exist in HTML today could be implemented using HTML/CSS/JS. It makes sense to provide a standardized way to accomplish this, with the short-term goals of reducing the size of browsers C++ code and making new element implementation easier, and the long-term goal of converging built-in HTML element implementations across browsers.&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;8&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|+ style=&amp;quot;caption-side:top; text-align: left; color:Gray&amp;quot; | Built-in HTML Elements Use Case Parameters&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Who&lt;br /&gt;
| Browser Engineer&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | What&lt;br /&gt;
| Implement a built-in HTML element by composing or extending existing HTML elements&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Purpose&lt;br /&gt;
|&lt;br /&gt;
* Reduce amount of custom UI code (fewer bugs, less code rot, leading to fewer future bugs).&lt;br /&gt;
* Remove magic: make it easier for authors to grok control behavior in familiar terms, allow authors to style controls using CSS.&lt;br /&gt;
* &#039;&#039;Stretch&#039;&#039;: specify built-in element behavior in terms of the component model specification.&lt;br /&gt;
|-&lt;br /&gt;
! align=&amp;quot;right&amp;quot; valign=&amp;quot;top&amp;quot; | Desirable Properties&lt;br /&gt;
|&lt;br /&gt;
* [[Component_Model#Encapsulation | Encapsulation]] -- ensure that implementation details are not exposed to the document&lt;br /&gt;
* [[Component_Model#Desugaring | Desugaring]] -- explain appearance and behavior of controls in terms of CSS/DOM.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Media Controls For The Video Element==&lt;br /&gt;
&lt;br /&gt;
Using DOM elements, build a media controls panel for the [http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#the-video-element video element]. The media controls include:&lt;br /&gt;
* timeline slider&lt;br /&gt;
* stop/start, replay, closed-captioning, forward, rewind and volume buttons, and&lt;br /&gt;
* a volume control, which is revealed when hovering over the volume button. &lt;br /&gt;
&lt;br /&gt;
The implementation details of the media controls should not be accessible or perceptible from outside of the video element. Document styles should not interfere with the styles of the media controls panel. However, we must provide a way for an author to explicitly style all parts of the media controls panel.&lt;br /&gt;
&lt;br /&gt;
==Details/Summary Elements==&lt;br /&gt;
&lt;br /&gt;
Implement [http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#the-details-element details] and [http://www.whatwg.org/specs/web-apps/current-work/multipage/interactive-elements.html#the-summary-element summary] elements. According to the spec, the first &amp;lt;code&amp;gt;summary&amp;lt;/code&amp;gt; element found in the flow content is used to represent a summary or legend of details. In case a &amp;lt;code&amp;gt;summary&amp;lt;/code&amp;gt; element is not found, the UA is supposed to auto-generate some fallback content. The &amp;lt;code&amp;gt;details&amp;lt;/code&amp;gt; element itself needs to have a marker indicating whether &amp;lt;code&amp;gt;details&amp;lt;/code&amp;gt; element is open or closed - i.e., whether all contents of &amp;lt;details&amp;gt; are shown, or only the summary.&lt;br /&gt;
&lt;br /&gt;
Just like media controls, the implementation should not be accessible by the consumer of the elements. For example, the reordering of flow content to position &amp;lt;code&amp;gt;summary&amp;lt;/code&amp;gt; element as first item in the disclosure widget should be imperceptible to DOM traversal methods.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7534</id>
		<title>Component Model Strawman: Styling</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7534"/>
		<updated>2011-10-31T18:08:09Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: add link to brainstorming page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;see also the [http://wiki.whatwg.org/wiki/Component_Model_CSS_Brainstorming brainstorming page].&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
There are 4 actors that may modify the style of (parts of) a component:&lt;br /&gt;
&lt;br /&gt;
* the browser&lt;br /&gt;
* the component author&lt;br /&gt;
* the page author&lt;br /&gt;
* the user&lt;br /&gt;
&lt;br /&gt;
We intend to use the ShadowScope to be the staging point for component styling&lt;br /&gt;
&lt;br /&gt;
= Specified Styles and Inheritance =&lt;br /&gt;
&lt;br /&gt;
To style the component in a way that meets expectations, we probably need an algorithm similar to the following:&lt;br /&gt;
&lt;br /&gt;
# The shadow root inherits styles from host element&#039;s parent ([[User:Rolandsteiner|RolandSteiner]]: directly or via ShadowScope?)&lt;br /&gt;
# All styles set on the host element (+) all styles set on the shadow root are applied to the shadow root element. To this end, the cascade order is (from least to most important):&lt;br /&gt;
## browser styles&lt;br /&gt;
## user styles&lt;br /&gt;
## component author styles on shadow root&lt;br /&gt;
## page author styles on the host element&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; page author styles on the host element&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; component author styles on the shadow root&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; user styles&lt;br /&gt;
&lt;br /&gt;
= Issues and Questions =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;What does it mean if the host element is assigned, e.g., &amp;lt;tt&amp;gt;display: table&amp;lt;/tt&amp;gt;?&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We could ignore that property value, but that seems rather arbitrary and requires a detailed spec on what is ignored when, how and why. Another (better?) approach could be to define a new value &amp;lt;tt&amp;gt;display: component&amp;lt;/tt&amp;gt;. If this value is set, an element renders as if it was a component - i.e., the element itself is not rendered, nor are its children by default. If it has a component bound to it, it is rendered instead. Otherwise, this is effectively equivalent to &amp;lt;tt&amp;gt;display: none&amp;lt;/tt&amp;gt; (or we could set a different fallback, e.g. &amp;lt;tt&amp;gt;display: inline&amp;lt;/tt&amp;gt;, but IMHO this just complicates things).&lt;br /&gt;
&lt;br /&gt;
To further facilitate this, we can add a pseudo-class &amp;lt;tt&amp;gt;:component&amp;lt;/tt&amp;gt; that matches if the element is a component. With this, the UA stylesheet just needs an entry &amp;lt;tt&amp;gt;:component { display: component }&amp;lt;/tt&amp;gt; to properly render components, while still allowing the page author to override specific elements he doesn&#039;t want to be rendered as components.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;In that case, what does it mean if a generated-content pseudo element such as &amp;lt;tt&amp;gt;::before&amp;lt;/tt&amp;gt; sets &amp;lt;tt&amp;gt;display: component&amp;lt;/tt&amp;gt;?&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We can either ignore this and treat it as equivalent to &amp;lt;tt&amp;gt;display: none&amp;lt;/tt&amp;gt; - the generated content does not have a component assigned to it after all - or use that as a staging point for decorators somehow.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7531</id>
		<title>Component Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7531"/>
		<updated>2011-10-29T01:41:12Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Introduction */ add more brainstorming links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here&#039;s a good starting point for learning about the [https://github.com/dglazkov/component-model component model spec], which is being developed by applying a [[Component_Model_Methodology | defined methodology]].&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Component Model&#039;&#039;&#039; introduces comprehensive support for creating DOM elements. [[Component_Model_Use_Cases | Examples]] include layout managers, combinations of Dojo and jQuery widgets, isolated widgets, such as Like/+1 buttons, and built-in HTML elements themselves.  Reflecting on the experience of Mozilla&#039;s XBL  and Microsoft Internet Explorer&#039;s HTML components, the Component Model formalizes the concept of loosely coupled, coherent units of [[Behavior Attachment | behavior]]  in the [http://www.w3.org/wiki/Open_Web_Platform Web platform]. The functionality goals of the Component Model resemble  the goals of [http://dev.w3.org/2006/xbl2/ XBL2]; unlike XBL2, the Component Model seeks to be more incremental and modular while leveraging and integrating with new technologies.&lt;br /&gt;
&lt;br /&gt;
Strawman pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Decorators Decorators]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Element_Registration Element Registration]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Styling Styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Isolation Isolation]&lt;br /&gt;
&lt;br /&gt;
Related links:&lt;br /&gt;
&lt;br /&gt;
* [[Behavior_Attachment | Behavior Attachment]] -- a general overview of the behavior attachment problem&lt;br /&gt;
* [[Component_Model_Methodology | Component Model Methodology]]&lt;br /&gt;
* [[Component_Model_Use_Cases | Component Model Use Cases]]&lt;br /&gt;
* [[Component_Model_Declarative_Syntax | Component Model Declarative Syntax]]&lt;br /&gt;
* [https://github.com/dglazkov/component-model Component Model Spec on Github]&lt;br /&gt;
* [http://dglazkov.github.com/component-model/ Component Model Spec Snapshot on Github Pages]&lt;br /&gt;
* [[Component_Model_Progressive_Enhancement | Component Model Progressive Enhancement]]&lt;br /&gt;
* [[Custom_Tags_Analysis | Custom Tags Analysis]]&lt;br /&gt;
&lt;br /&gt;
Discussion and brainstorming pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion Main discussion page with open questions]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion:_Rendering Rendering-specific discussion]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Brainstorming general brainstorming]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_CSS_Brainstorming brainstorming page about CSS and styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Isolation_Brainstorming brainstorming page about isolation and confinement]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Decorator_Brainstorming brainstorming page about decorators]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_IDL_Brainstorming brainstorming page about IDLs and communication across boundaries]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Aspect-oriented_Components_Brainstorming brainstorming about aspect-oriented components]&lt;br /&gt;
&lt;br /&gt;
=Properties=&lt;br /&gt;
&lt;br /&gt;
The component model aims to satisfy several key properties. These properties were extracted from the [[Component_Model_Use_Cases | use cases]]. This section explains component model basics by studying each property.&lt;br /&gt;
&lt;br /&gt;
==Extensibility==&lt;br /&gt;
&lt;br /&gt;
The component model enables creation of new types of DOM elements by allowing the use of existing DOM elements in JavaScript prototype chain. For example, here&#039;s how you would create a new sub-type of HTMLElement:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
LayoutManagerPanel.prototype = Object.create(HTMLElement.prototype);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
// 1) Will not be able to add instances of LayoutManagerPanel to document without this call.&lt;br /&gt;
// 2) First parameter specifies the tagName of the element being registered and must be a string prefixed with &amp;quot;x-&amp;quot;.&lt;br /&gt;
Element.register(&amp;quot;x-layout-manager-panel&amp;quot;, LayoutManagerPanel);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
var panel = new LayoutManagerPanel();&lt;br /&gt;
document.body.appendChild(panel);&lt;br /&gt;
// or&lt;br /&gt;
document.body.innerHTML = &amp;quot;&amp;lt;x-layout-manager-panel&amp;gt;&amp;lt;/x-layout-manager-panel&amp;gt;&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt; instance is a Javascript object that is a valid DOM element, which can be added to the DOM tree. You can then extend this object using standard Javascript prototype inheritance.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
==Consistency==&lt;br /&gt;
&lt;br /&gt;
Because components are just DOM objects, they inherently share the same traversal and manipulation APIs, as defined by the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html DOM4]. The authors of components can extend these APIs by adding custom methods and properties on DOM objects, using standard JavaScript inheritance:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Widget.prototype = Object.create(HTMLElement.prototype, {&lt;br /&gt;
    update: {&lt;br /&gt;
        value: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
    value: {&lt;br /&gt;
        get: function() { /* ... */ },&lt;br /&gt;
        set: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
   // ...&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The common API surface and the ability to extend it serves as a natural API boundary for framework authors, enabling interoperability.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
&lt;br /&gt;
==Encapsulation==&lt;br /&gt;
Encapsulation refers to ability of the component to hide its implementation details and state from the document. To enable hiding of the implementation details, the component model provides a way to build a DOM tree that is not accessible from the document DOM tree, but is rendered as part of the document. This DOM tree, associated with the component is the [http://glazkov.com/2011/01/14/what-the-heck-is-shadow-dom/ shadow DOM]. The boundary between the document DOM tree and shadow DOM tree provides complete encapsulation, and ensures that:&lt;br /&gt;
* no shadow DOM tree nodes cross this boundary during event dispatch;&lt;br /&gt;
* document DOM tree has no access to nodes in the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Additionally, the boundary serves as a convenient style application lever, giving the component a choice of letting (or not letting) document CSS affect the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Every DOM element instance may only have (or &#039;&#039;host&#039;&#039;) one shadow DOM tree. A shadow tree is instantiated by creating an instance of the &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; object, which takes a reference to the hosting element as a parameter. Attempting to create more than one instance for the same element throws an exception:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
    var shadow = new ShadowRoot(this);&lt;br /&gt;
    var shadow2 = new ShadowRoot(this); // throws an exception.&lt;br /&gt;
   // ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
&lt;br /&gt;
==Composability==&lt;br /&gt;
&lt;br /&gt;
Being DOM objects, components fit naturally into the document DOM tree and support all of its composition properties. In addition, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element allows controlling interaction between shadow and document DOM trees. A &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element specifies places where immediate document tree children of the component are rendered &#039;&#039;inside&#039;&#039; the shadow tree.&lt;br /&gt;
&lt;br /&gt;
There can be more than one &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element in the shadow tree. The &amp;lt;code&amp;gt;includes&amp;lt;/code&amp;gt; attribute provides a convenient way to sort element&#039;s children by CSS selector. For example, a &amp;lt;code&amp;gt;DockLayoutPanel&amp;lt;/code&amp;gt; component could be used like this in the document DOM tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Chauncey Gardiner.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Provided that its shadow DOM tree looks like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content includes=&amp;amp;quot;.west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The document DOM tree children on of &amp;lt;code&amp;gt;x-dock-layout-panel&amp;lt;/code&amp;gt; will be rendered as if composed from this tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Avid Gardener.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Desugaring==&lt;br /&gt;
The component model also explains pretty well how the native HTML elements are built and dispels some of the magic associated with the &amp;quot;DOM object vs. JavaScript object&amp;quot; juxtaposition.&lt;br /&gt;
&lt;br /&gt;
Allowing DOM elements to participate in the JavaScript inheritance chain makes DOM elements more approachable and easier to work with.&lt;br /&gt;
&lt;br /&gt;
Complex DOM elements that are rendered with more than one CSS box (and aren&#039;t specified in terms of CSS, like [http://dev.w3.org/csswg/css3-lists/ lists]) are just components that have shadow DOM. Coincidentally, this also explains why you can&#039;t add shadow DOM subtrees to &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;details&amp;lt;/code&amp;gt; elements -- their &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;s are claimed by &amp;lt;code&amp;gt;HTMLInputElement&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;HTMLDetailsElement&amp;lt;/code&amp;gt; constructors, respectively.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
Considering the way Web works, the component model must allow decoupling of the instantiation and the declaration of the components in order to provide reasonable performance characteristics. It&#039;s an unfortunate, but necessary requirement. In other words, we must be able to handle situations where a component instance is created before it is declared. Here&#039;s an simple example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// somewhere in view.js&lt;br /&gt;
...&lt;br /&gt;
document.body.innerHTML = &#039;&amp;lt;div class=&amp;quot;awesome&amp;quot;&amp;gt;&amp;lt;x-layout&amp;gt;&amp;lt;x-spring-panel&amp;gt;...&amp;lt;/x-spring-panel&amp;gt;&amp;lt;/x-layout&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
// somewhere in layout.js&lt;br /&gt;
Element.register(&#039;x-layout&#039;, Layout);&lt;br /&gt;
Element.register(&#039;x-spring-panel&#039;, SpringPanel);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this situation, there is no room for error: &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt; &#039;&#039;must&#039;&#039; wait for &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; to load before executing. You can&#039;t load &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; lazily or in any different order, since it defines the components that are used in &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt;. Given that asynchronous, deferred or lazy-loading of script are all common performance techniques in today&#039;s Web, we must do better than block or throw an exception in such cases.&lt;br /&gt;
&lt;br /&gt;
The component model offers this solution:&lt;br /&gt;
&lt;br /&gt;
When an unknown DOM element with an &amp;quot;x-&amp;quot;-prefixed &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt; is encountered, we put a placeholder &amp;lt;code&amp;gt;HTMLUnknownElement&amp;lt;/code&amp;gt; instance in its place. As soon as the element is defined, all placeholder instances are replaced ([http://www.w3.org/TR/DOM-Level-3-Core/core.html#Document3-renameNode Document.renameNode]) with the new, proper DOM element.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
== Confinement ==&lt;br /&gt;
Confinement refers to the document protecting its implementation details and state from the component and can be viewed as the inverse of [[#Encapsulation | encapsulation]].&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks=&lt;br /&gt;
&lt;br /&gt;
The component model is comprised of the following building blocks.&lt;br /&gt;
&lt;br /&gt;
==Shadow DOM==&lt;br /&gt;
&lt;br /&gt;
Any DOM element can host a shadow DOM subtree. The shadow DOM subtree originates at &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;, which is coupled the hosting element at the time of its construction. You don&#039;t need any other building blocks in order to take advantage of the shadow DOM:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var element = document.createElement(&amp;quot;div&amp;quot;);&lt;br /&gt;
var shadow = new ShadowRoot(element);&lt;br /&gt;
shadow.appendChild(document.createElement(&amp;quot;p&amp;quot;)).textContent = &amp;quot;weee!!&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; instance is a [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-node Node], and acts as the root of the element&#039;s shadow DOM subtree. The &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; itself is never rendered, nor has styles. In this regard, it&#039;s similar to the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-documentfragment DocumentFragment]. It has two properties:&lt;br /&gt;
* &amp;lt;code&amp;gt;applyAuthorSheets&amp;lt;/code&amp;gt;, which is either &#039;&#039;&#039;true&#039;&#039;&#039; (that is, apply author style sheets from the document), or &#039;&#039;&#039;false&#039;&#039;&#039; (don&#039;t);&lt;br /&gt;
* &amp;lt;code&amp;gt;shadowHost&amp;lt;/code&amp;gt;, which points to the hosting element.&lt;br /&gt;
&lt;br /&gt;
==Content Element==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element is used with [[#Shadow_DOM | Shadow DOM]] and provides a mechanism for distributing hosting element&#039;s children inside of its shadow subtree. To preserve the [[#Encapsulation | encapsulation]] property, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; elements act as insertion points and do not leak any information about hosting element&#039;s children to the shadow DOM subtree or vise versa.&lt;br /&gt;
&lt;br /&gt;
==Constructable DOM Types==&lt;br /&gt;
The inability to construct DOM element using &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt; (with some exceptions) or use them in the prototype inheritance chain had confounded many Web developers since the beginning of DOM. This building block intends to rectify at least the latter by allowing &amp;lt;code&amp;gt;HTMLElement.call&amp;lt;/code&amp;gt; invocation and thus enabling creation of JavaScript objects with DOM elements in the prototype chain.&lt;br /&gt;
&lt;br /&gt;
==Registering Elements==&lt;br /&gt;
Working in conjunction with  [[#Constructable_DOM_Types | Constructable DOM Types]], this building block makes the list of valid markup tag names extensible by exposing &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
partial interface Element {&lt;br /&gt;
    static void register(in String tagName, in Function constructor);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to envisage a milder (though less elegant) version of element registration by keeping DOM element construction magical (thus decoupling it from [[#Constructable_DOM_Types | Constructable DOM Types]]) and making &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; use a callback, rather than &amp;lt;code&amp;gt;constructor&amp;lt;/code&amp;gt; as parameter. The callback would be invoked with an already-constructed DOM object with the specified &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt;, leaving the work of setting up properties on this object to the callback.&lt;br /&gt;
&lt;br /&gt;
==Confinement Primitives==&lt;br /&gt;
&lt;br /&gt;
The API surface of the component model lends itself well to proper confinement. Here&#039;s an approach that could be used to provide it (very early brainstorming):&lt;br /&gt;
&lt;br /&gt;
* Confinement is not tied to the component model. Instead, it&#039;s a new twist on the method of loading scripts. A script could be loaded as usual or it could be &#039;&#039;confined&#039;&#039;, or loaded into its own context.&lt;br /&gt;
&lt;br /&gt;
* When confined, a script has its own global and document objects. These objects only reveal some safe limited subset of the actual document objects.  Think of it as a same-origin iframe with restrictions on document and window.&lt;br /&gt;
&lt;br /&gt;
* You can communicate with the main document using &amp;lt;code&amp;gt;window.postMessage&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* The confined document DOM tree is always empty. Attempting to insert into it throws exceptions.&lt;br /&gt;
&lt;br /&gt;
* ... except when you append to elements in shadow DOM. That&#039;s right, you can do &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;new ShadowRoot&amp;lt;/code&amp;gt; in the confined document.&lt;br /&gt;
&lt;br /&gt;
* Whenever you register an element, it registers &#039;&#039;in the main document&#039;&#039; as well. Creating an instance of a component from an confined document produces a functional DOM element shell that proxies to the actual element in the confined document.&lt;br /&gt;
&lt;br /&gt;
Proposed API: introduce a new &amp;lt;code&amp;gt;confined&amp;lt;/code&amp;gt; attribute to the &amp;lt;code&amp;gt;script&amp;lt;/code&amp;gt; element. Presence of this attribute triggers loading scripts in the confined context.&lt;br /&gt;
&lt;br /&gt;
Confinement of script execution could be useful outside of the component model and also could be related to [https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html Content Security Policy].&lt;br /&gt;
&lt;br /&gt;
* [[Component_Model_Isolation_Brainstorming | Isolation Brainstorm]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks Use Case Coverage=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of building blocks, tabulated against the [[Component_Model_Use_Cases | use cases]] and approximate percentage of satisfying them:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | Building Block&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Layout_Manager | Layout Manager]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Widget_Mix-and-Match | Mix-and-Match]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Rendering_Form_Controls_with_SVG | SVG Controls]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Contacts_Widget | Contacts Widget]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Like.2F.2B1_Button | Like/+1 Button]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Media_Controls_For_The_Video_Element | Media Controls for the Video Element]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Details.2FSummary_Elements | Details/Summary Element]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| 34%&lt;br /&gt;
| 100%&lt;br /&gt;
| 25%&lt;br /&gt;
| 100%&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Content_Element | Content Element]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Registering_Elements | Registering Elements]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Comparison With Existing Specs and Implementations=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a brief overview of existing similar specifications and implementations:&lt;br /&gt;
* [http://msdn.microsoft.com/en-us/library/ms531018(v=vs.85).aspx HTML Components] is a [http://windows.microsoft.com/en-US/internet-explorer/products/ie/home Microsoft Internet Explorer]-specific method of creating custom DOM elements. Also see [http://www.w3.org/TR/NOTE-HTMLComponents HTML Components Note] (implemented in IE5+).&lt;br /&gt;
* [http://www.w3.org/TR/2001/NOTE-xbl-20010223/ XBL], currently implemented in Mozilla.&lt;br /&gt;
* [http://dev.w3.org/2006/xbl2/ XBL2], the ancestral spec of the Component Model, and a revision of XBL.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a handy overview of how each of these specs satisfies the component model [[#Properties | properties]]:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | Spec/Implementation&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Extensibility | Extensibility]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Consistency | Consistency]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Encapsulation | Encapsulation]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Composability | Composability]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Desugaring | Desugaring]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Performance | Performance]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Confinement | Confinement]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | HTML Components&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Components are magic, inextensible objects.&lt;br /&gt;
| &#039;&#039;&#039;Almost&#039;&#039;&#039;. Implementation provides ways to add properties, methods, events to element API, and the components are &#039;&#039;almost&#039;&#039; DOM elements. However, custom tags don&#039;t support all properties of a DOM element.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. There are some provisions for event encapsulation, nothing else.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. No provisions for handling document children vs. component-defined children.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The mechanism for extending bindings is entirely independent of DOM type or Javascript extensibility.&lt;br /&gt;
| &#039;&#039;&#039;Yes-ish&#039;&#039;&#039;. Bindings can override properties on the DOM element, although the mechanism is highly unnatural (XML declarations).&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;? Hard to say looking at TR note.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;. Some HTML elements in Gecko are implemented using it.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL2&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Same as XBL.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Bindings are discouraged from establishing an API surface on a bound element.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The spec didn&#039;t intend to describe how native elements are built.&lt;br /&gt;
| &#039;&#039;&#039;Somewhat&#039;&#039;&#039;. The lifecycle of a binding is well-defined and initialization stages are well-decoupled. However, there is no way to build a binding imperatively without loading a binding document.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The key differences between XBL2 and the Component Model are:&lt;br /&gt;
* The Component Model fully embraces the [[Behavior_Attachment#Behavior_Attachment_Methods | element behavior attachment]] by allowing creation of new types of DOM elements within a document. This is something Web Framework developers always wanted and repeatedly try to do with parallel object hierarchies. Eliminating ephemerality of the attachment simplifies and clarifies how things work conceptually -- there is no longer a place for &amp;quot;spooky action at a distance&amp;quot;, caused by a change of a random CSS selector or even removing an element from the tree.&lt;br /&gt;
* The Component Model is strongly biased toward reusing existing bits of the platform and well-established techniques instead of inventing new ones. For instance, instead of bindings inheritance, we rely on prototype inheritance. Instead of endeavoring to solve the incredibly complex, yet dubious problem of multiple bindings or shadow DOM trees, we simply suggest composition.&lt;br /&gt;
* The Component Model strives to add capabilities in layers (see [[#Building_Blocks | building blocks]]), each able to function on its own. The omnibus nature of XBL2 removes opportunities for layering, particularly as element identity, life cycle, and scripting are concerned. Perhaps this could be repaired somehow, but Component Model solves these issues without further complicating an already large, difficult to understand spec.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Aspect-oriented_Components_Brainstorming&amp;diff=7530</id>
		<title>Component Model Aspect-oriented Components Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Aspect-oriented_Components_Brainstorming&amp;diff=7530"/>
		<updated>2011-10-29T01:38:15Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: Initial stub&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Example =&lt;br /&gt;
&lt;br /&gt;
component declaration:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;template name=&amp;quot;x-base&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;template name=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;content select=&amp;quot;X&amp;quot;&amp;gt;&amp;lt;/content&amp;gt;&lt;br /&gt;
      &amp;lt;/template&amp;gt;&lt;br /&gt;
      &amp;lt;template name=&amp;quot;center&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;content select=&amp;quot;Y&amp;quot;&amp;gt;&amp;lt;/content&amp;gt;&lt;br /&gt;
      &amp;lt;/template&amp;gt;&lt;br /&gt;
      &amp;lt;template name=&amp;quot;bottom&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;content select=&amp;quot;Z&amp;quot;&amp;gt;&amp;lt;/content&amp;gt;&lt;br /&gt;
      &amp;lt;/template&amp;gt;&lt;br /&gt;
      &amp;lt;template&amp;gt; &amp;lt;!-- main template --&amp;gt;&lt;br /&gt;
          &amp;lt;use name=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;/use&amp;gt;&lt;br /&gt;
          &amp;lt;use name=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;/use&amp;gt;&lt;br /&gt;
          &amp;lt;use name=&amp;quot;bottom&amp;quot;&amp;gt;&amp;lt;/use&amp;gt;&lt;br /&gt;
          &amp;lt;content select=&amp;quot;W&amp;quot;&amp;gt;&amp;lt;/content&amp;gt;        &lt;br /&gt;
      &amp;lt;/template&amp;gt;&lt;br /&gt;
    &amp;lt;/template&amp;gt;&lt;br /&gt;
&lt;br /&gt;
derived component overriding main template. Pattern derived components will use most often.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;template name=&amp;quot;x-derived1&amp;quot; base=&amp;quot;x-base&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;template&amp;gt;&lt;br /&gt;
          &amp;lt;content select=&amp;quot;Z&amp;quot;&amp;gt;&amp;lt;/content&amp;gt;        &lt;br /&gt;
          &amp;lt;use name=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;/use&amp;gt;&lt;br /&gt;
          &amp;lt;use name=&amp;quot;center&amp;quot;&amp;gt;&amp;lt;/use&amp;gt;&lt;br /&gt;
          &amp;lt;use name=&amp;quot;bottom&amp;quot;&amp;gt;&amp;lt;/use&amp;gt;&lt;br /&gt;
      &amp;lt;/template&amp;gt;&lt;br /&gt;
  &amp;lt;/template&amp;gt;&lt;br /&gt;
&lt;br /&gt;
derived component overriding a part template. All &amp;lt;use&amp;gt; elements referring to &amp;quot;top&amp;quot; in the finalized component will now render below structure instead. Pattern decorators will use most often&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;template name=&amp;quot;x-derived2&amp;quot; base=&amp;quot;x-base&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;template name=&amp;quot;top&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;content select=&amp;quot;X&amp;quot;&amp;gt;&amp;lt;/content&amp;gt;&lt;br /&gt;
          &amp;lt;content select=&amp;quot;Z&amp;quot;&amp;gt;&amp;lt;/content&amp;gt;        &lt;br /&gt;
      &amp;lt;/template&amp;gt;&lt;br /&gt;
  &amp;lt;/template&amp;gt;&lt;br /&gt;
&lt;br /&gt;
combination: derived component overriding main template and a part template, and adding a new template, all at once. Pattern derived components will use often.&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;template name=&amp;quot;x-derived1&amp;quot; base=&amp;quot;x-base&amp;quot;&amp;gt;&lt;br /&gt;
      &amp;lt;template name=&amp;quot;bottom&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;amp;lt;hr&amp;amp;gt;&lt;br /&gt;
          &amp;lt;content select=&amp;quot;Z&amp;quot;&amp;gt;&amp;lt;/content&amp;gt;&lt;br /&gt;
      &amp;lt;/template&amp;gt;&lt;br /&gt;
      &amp;lt;template name=&amp;quot;left&amp;quot;&amp;gt;&lt;br /&gt;
          &amp;lt;content select=&amp;quot;Y&amp;quot;&amp;gt;&amp;lt;/content&amp;gt;&lt;br /&gt;
      &amp;lt;/template&amp;gt;&lt;br /&gt;
      &amp;lt;template&amp;gt;&lt;br /&gt;
          &amp;lt;use name=&amp;quot;top&amp;quot;&amp;gt;&amp;lt;/use&amp;gt;&lt;br /&gt;
          &amp;lt;use name=&amp;quot;bottom&amp;quot;&amp;gt;&amp;lt;/use&amp;gt;&lt;br /&gt;
      &amp;lt;/template&amp;gt;&lt;br /&gt;
  &amp;lt;/template&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Issues =&lt;br /&gt;
&lt;br /&gt;
* Splitting scripting among parts - how to &amp;quot;re-route&amp;quot; scripting to overriding parts? probably not possible -&amp;gt; rely on heavy messaging instead?&lt;br /&gt;
* Overriding parts again requires a certain knowledge of a components internals - at least which parts exist and what they do (then again, this is also the point)&lt;br /&gt;
* How to best apply &amp;amp; remove &amp;quot;decorators&amp;quot;?&lt;br /&gt;
* It&#039;s not possible to extend a template or part (adding or wrapping the base part, but also rendering it) - it&#039;s either leave the original or replace it completely. The ability to extend seems desirable in some cases, but would then re-raise the XBL inheritance questions. How to best reconcile this? (or ignore it?)&lt;br /&gt;
* In some sense all this creates a mother-of-all-flattened-trees&lt;br /&gt;
* Can this work if some parts are being isolated?&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7528</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7528"/>
		<updated>2011-10-29T01:06:36Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Implementation Approaches */ divide shadow-DOM approaches, add aspect-oriented approach&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This makes the decorator the &amp;quot;more important&amp;quot; part in the relation. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
[[User:Rolandsteiner|RolandSteiner]] Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
=== Decorating Component Parts ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to have the ability to decorate specific parts of a component. E.g., the caps-lock indicator in an &amp;lt;tt&amp;gt;&amp;amp;lt;input&amp;amp;gt;&amp;lt;/tt&amp;gt; field could be considered a decorator.&lt;br /&gt;
&lt;br /&gt;
However, this clashes with the desire to not make the internals of components public. To reconcile this we&#039;d need a better model of how to declare component parts, whether &amp;quot;aspect-oriented components&amp;quot; or something different.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Binding Approaches =&lt;br /&gt;
&lt;br /&gt;
== CSS ==&lt;br /&gt;
&lt;br /&gt;
=== XBL Approach ===&lt;br /&gt;
&lt;br /&gt;
XBL uses a CSS attribute &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; to assign bindings to elements, as well as allowing elements to add bindings explicitly via &amp;lt;tt&amp;gt;element.addBinding()&amp;lt;/tt&amp;gt;. While XBL specifies implicit bindings, as would be used by decorators, the natural vehicle to apply decorators - CSS - only seems to allow one (?).&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Properties ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS &amp;lt;tt&amp;gt;decorator-&amp;amp;lt;xyz&amp;amp;gt;&amp;lt;/tt&amp;gt; property with the values &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;apply&amp;lt;/tt&amp;gt;. Rules can then switch individual decorators on or off.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* allows decorators to be switched on or off based on rules&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* requires probably controversial CSS extension&lt;br /&gt;
* does not define where decorator is rendered&lt;br /&gt;
* does not allow classification which decorators are applicable to which elements&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Pseudo-elements ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS pseudo-element or - probably better - an ID that can be accessed via a pseudo-element function &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* potentially easier to get acceptance for &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt; than for decorator properties.&lt;br /&gt;
* pseudo-element kinda makes sense, since the decorator can be considered becoming part of the decorated element&lt;br /&gt;
* allows further styling of the decorator&lt;br /&gt;
* classification what decorators can be applied to which elements in the realm of the possible (make &#039;illegal&#039; decorators fail in the CSS selector matching).&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* what are the properties for the pseudo-element?&lt;br /&gt;
* how to turn off a set pseudo-element again?&lt;br /&gt;
&lt;br /&gt;
= Implementation Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like shadow DOM, rendered as overlay ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM as an overlay to the &amp;quot;normal&amp;quot; rendering.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness and scriptability of DOM&lt;br /&gt;
* Uses tools we already have or develop for components, no interaction between decorator and regular element rendering&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS), but less of an issue than with XBL-inheritance approaches&lt;br /&gt;
* Overlays are quite limited in capabilities&lt;br /&gt;
&lt;br /&gt;
== Component-like shadow DOM, with inheritance ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness and scriptability of DOM&lt;br /&gt;
* Uses tools we already have or develop for components, no interaction between decorator and regular element rendering&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS)&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;br /&gt;
* (Re-)raises questions about (explicit or implicit) XBL-like inheritance, overriding and/or hiding of previously applied shadow trees&lt;br /&gt;
&lt;br /&gt;
== Aspect-oriented components ==&lt;br /&gt;
&lt;br /&gt;
Components are assembled from parts, which are essentially &amp;quot;micro-templates&amp;quot;. Sub-classes and decorators can override any or all of those parts. What is rendered is an auto-flattening of all final parts.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Defines inner structure of components, makes individual parts decoratable/replaceable&lt;br /&gt;
* Parts can serve as pseudo-element targets naturally&lt;br /&gt;
* Individual parts should be responsible for a limited subset of the host element&#039;s children, reducing the potential conflict area between multiple parts vying for the same host elements&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Best trigger mechanism undefined (questionable whether CSS is a good fit)&lt;br /&gt;
* Probably very heavy in application.&lt;br /&gt;
* Requires discipline from authors to set up effectively&lt;br /&gt;
* Scripts may hold references to elements in parts that &amp;quot;go away&amp;quot; on updates (may not be a problem in practice)&lt;br /&gt;
&lt;br /&gt;
== In-between ==&lt;br /&gt;
&lt;br /&gt;
Determine decorators in terms of CSS layout, but define that layout in terms of a DOM and open it up to scripting - e.g., auto-instantiate the DOM when a content-generating pseudo-element is used.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Simplicity of CSS application, but allowing for scripting&lt;br /&gt;
* Details what is currently &amp;quot;hidden&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Performance questions&lt;br /&gt;
* Content-generating pseudo-classes may not fit a single DOM template&lt;br /&gt;
* Defining things in terms of DOM may block future additions to CSS that then would no longer fit that definition (and thus break pages)&lt;br /&gt;
* Performant implementation may require multiple renderers per node&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7527</id>
		<title>Component Model Strawman: Styling</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7527"/>
		<updated>2011-10-29T00:40:55Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Specified Styles and Inheritance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
There are 4 actors that may modify the style of (parts of) a component:&lt;br /&gt;
&lt;br /&gt;
* the browser&lt;br /&gt;
* the component author&lt;br /&gt;
* the page author&lt;br /&gt;
* the user&lt;br /&gt;
&lt;br /&gt;
We intend to use the ShadowScope to be the staging point for component styling&lt;br /&gt;
&lt;br /&gt;
= Specified Styles and Inheritance =&lt;br /&gt;
&lt;br /&gt;
To style the component in a way that meets expectations, we probably need an algorithm similar to the following:&lt;br /&gt;
&lt;br /&gt;
# The shadow root inherits styles from host element&#039;s parent ([[User:Rolandsteiner|RolandSteiner]]: directly or via ShadowScope?)&lt;br /&gt;
# All styles set on the host element (+) all styles set on the shadow root are applied to the shadow root element. To this end, the cascade order is (from least to most important):&lt;br /&gt;
## browser styles&lt;br /&gt;
## user styles&lt;br /&gt;
## component author styles on shadow root&lt;br /&gt;
## page author styles on the host element&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; page author styles on the host element&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; component author styles on the shadow root&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; user styles&lt;br /&gt;
&lt;br /&gt;
= Issues and Questions =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;What does it mean if the host element is assigned, e.g., &amp;lt;tt&amp;gt;display: table&amp;lt;/tt&amp;gt;?&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We could ignore that property value, but that seems rather arbitrary and requires a detailed spec on what is ignored when, how and why. Another (better?) approach could be to define a new value &amp;lt;tt&amp;gt;display: component&amp;lt;/tt&amp;gt;. If this value is set, an element renders as if it was a component - i.e., the element itself is not rendered, nor are its children by default. If it has a component bound to it, it is rendered instead. Otherwise, this is effectively equivalent to &amp;lt;tt&amp;gt;display: none&amp;lt;/tt&amp;gt; (or we could set a different fallback, e.g. &amp;lt;tt&amp;gt;display: inline&amp;lt;/tt&amp;gt;, but IMHO this just complicates things).&lt;br /&gt;
&lt;br /&gt;
To further facilitate this, we can add a pseudo-class &amp;lt;tt&amp;gt;:component&amp;lt;/tt&amp;gt; that matches if the element is a component. With this, the UA stylesheet just needs an entry &amp;lt;tt&amp;gt;:component { display: component }&amp;lt;/tt&amp;gt; to properly render components, while still allowing the page author to override specific elements he doesn&#039;t want to be rendered as components.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;In that case, what does it mean if a generated-content pseudo element such as &amp;lt;tt&amp;gt;::before&amp;lt;/tt&amp;gt; sets &amp;lt;tt&amp;gt;display: component&amp;lt;/tt&amp;gt;?&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We can either ignore this and treat it as equivalent to &amp;lt;tt&amp;gt;display: none&amp;lt;/tt&amp;gt; - the generated content does not have a component assigned to it after all - or use that as a staging point for decorators somehow.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Progressive_Enhancement&amp;diff=7526</id>
		<title>Component Model Progressive Enhancement</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Progressive_Enhancement&amp;diff=7526"/>
		<updated>2011-10-29T00:37:12Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A. While adding an element to a DOM tree:&lt;br /&gt;
# Check for existence of the &amp;lt;code&amp;gt;becomes&amp;lt;/code&amp;gt; attribute. If the attribute exists:&lt;br /&gt;
## Check the value of  the &amp;lt;code&amp;gt;becomes&amp;lt;/code&amp;gt; attribute against the names of already defined elements. &lt;br /&gt;
### If such element exists, go to step X.&lt;br /&gt;
### Otherwise, store a reference to this instance in a &amp;quot;may-become&amp;quot; table.&lt;br /&gt;
&lt;br /&gt;
B. When a new element is registered:&lt;br /&gt;
# Check to see if there are any instances waiting in the &amp;quot;may-become&amp;quot; table for this element&#039;s name&lt;br /&gt;
# If so, collect all these instances and, for each instance, go to step X.&lt;br /&gt;
&lt;br /&gt;
C. When the &amp;quot;becomes&amp;quot; attribute is set:&lt;br /&gt;
# If the element is in tree, go to step A 1.1.&lt;br /&gt;
&lt;br /&gt;
X. Becoming another element (in Element existing instance).&lt;br /&gt;
# Create the element by the name, specified in the &amp;lt;code&amp;gt;becomes&amp;lt;/code&amp;gt; attribute of the existing instance&lt;br /&gt;
# If the existing instance is already in document tree:&lt;br /&gt;
## execute renameNode (or something better) to replace the old element with the newly created element.&lt;br /&gt;
## Otherwise, insert newly create element in DOM tree.&lt;br /&gt;
# Fire &amp;quot;&amp;lt;code&amp;gt;become&amp;lt;/code&amp;gt;&amp;quot; event on the existing instance.&lt;br /&gt;
# Set &amp;lt;code&amp;gt;became&amp;lt;/code&amp;gt; property on the existing instance to point to the newly created element.&lt;br /&gt;
&lt;br /&gt;
[[User:Rolandsteiner|RolandSteiner]] Does this mean an author may need to duplicate CSS selectors, e.g., if we have &amp;lt;tt&amp;gt;&amp;amp;lt;div becomes=&amp;quot;x-foo&amp;quot; class=&amp;quot;c&amp;quot;&amp;amp;gt;&amp;lt;/tt&amp;gt; and a selector &amp;lt;tt&amp;gt;div.c&amp;lt;/tt&amp;gt;, don&#039;t we then also need an equivalent selector &amp;lt;tt&amp;gt;x-foo.c&amp;lt;/tt&amp;gt;? OTOH, is it a problem? Perhaps more so in JS with querySelectorAll than in CSS?&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Progressive_Enhancement&amp;diff=7525</id>
		<title>Component Model Progressive Enhancement</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Progressive_Enhancement&amp;diff=7525"/>
		<updated>2011-10-29T00:36:25Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: add question&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A. While adding an element to a DOM tree:&lt;br /&gt;
# Check for existence of the &amp;lt;code&amp;gt;becomes&amp;lt;/code&amp;gt; attribute. If the attribute exists:&lt;br /&gt;
## Check the value of  the &amp;lt;code&amp;gt;becomes&amp;lt;/code&amp;gt; attribute against the names of already defined elements. &lt;br /&gt;
### If such element exists, go to step X.&lt;br /&gt;
### Otherwise, store a reference to this instance in a &amp;quot;may-become&amp;quot; table.&lt;br /&gt;
&lt;br /&gt;
B. When a new element is registered:&lt;br /&gt;
# Check to see if there are any instances waiting in the &amp;quot;may-become&amp;quot; table for this element&#039;s name&lt;br /&gt;
# If so, collect all these instances and, for each instance, go to step X.&lt;br /&gt;
&lt;br /&gt;
C. When the &amp;quot;becomes&amp;quot; attribute is set:&lt;br /&gt;
# If the element is in tree, go to step A 1.1.&lt;br /&gt;
&lt;br /&gt;
X. Becoming another element (in Element existing instance).&lt;br /&gt;
# Create the element by the name, specified in the &amp;lt;code&amp;gt;becomes&amp;lt;/code&amp;gt; attribute of the existing instance&lt;br /&gt;
# If the existing instance is already in document tree:&lt;br /&gt;
## execute renameNode (or something better) to replace the old element with the newly created element.&lt;br /&gt;
## Otherwise, insert newly create element in DOM tree.&lt;br /&gt;
# Fire &amp;quot;&amp;lt;code&amp;gt;become&amp;lt;/code&amp;gt;&amp;quot; event on the existing instance.&lt;br /&gt;
# Set &amp;lt;code&amp;gt;became&amp;lt;/code&amp;gt; property on the existing instance to point to the newly created element.&lt;br /&gt;
&lt;br /&gt;
[[User:Rolandsteiner|RolandSteiner]] Does this mean an author may need to duplicate CSS selectors, e.g., if we have &amp;lt;tt&amp;gt;&amp;amp;lt;div becomes=&amp;quot;x-foo&amp;quot; class=&amp;quot;c&amp;quot;&amp;amp;gt;&amp;lt;/tt&amp;gt; and a selector &amp;lt;tt&amp;gt;div.c&amp;lt;/tt&amp;gt;, don&#039;t we then also need an equivalent selector &amp;lt;tt&amp;gt;x-foo.c&amp;lt;/tt&amp;gt;? OTOH, is it a problem?&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7524</id>
		<title>Component Model Strawman: Isolation</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7524"/>
		<updated>2011-10-29T00:33:11Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Terms ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Confined&#039;&#039;&#039;: disallow a component from accessing the containing page. Useful when a page does not trust the component or its source.&lt;br /&gt;
* &#039;&#039;&#039;Encapsulated&#039;&#039;&#039;: disallow the containing page from accessing the internals of the component. Useful when a component wants to prevent a page from meddling with it.&lt;br /&gt;
* &#039;&#039;&#039;Isolated&#039;&#039;&#039;: a component that is both confined and encapsulated.&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Autonomy ===&lt;br /&gt;
&lt;br /&gt;
Components should be autonomous entities that can be loaded and applied as a single building block. Avoid requiring extensive manipulations on both side of the page &amp;lt;=&amp;gt; component divide.&lt;br /&gt;
&lt;br /&gt;
This will also help in implementing decorators.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
The interface of a component should be minimal and well defined. Embedding pages should not be required (nor able to in the case of encapsulation) to access, or even know about, the internals of a component. Conversely, the function of a component should not depend on being able to access the DOM or any other information of the hosting page that is not provided through an interface.&lt;br /&gt;
&lt;br /&gt;
The component should be able to apply and filter data and styles passed in as it sees fit.&lt;br /&gt;
&lt;br /&gt;
=== Transparency ===&lt;br /&gt;
&lt;br /&gt;
Whether or not a component is isolated should ideally be transparent to both the component and the hosting DOM.&lt;br /&gt;
&lt;br /&gt;
= Loading an External HTML Resource =&lt;br /&gt;
&lt;br /&gt;
The element registration and template definition also can be done in an external, separate HTML resource.&lt;br /&gt;
Author can define a set of elements inside the external HTML and use it in different HTML pages. &lt;br /&gt;
&lt;br /&gt;
Effective markup vocabulary for the external HTML is limited.&lt;br /&gt;
Agents only recognize the first &amp;lt;tt&amp;gt;head element&amp;lt;/tt&amp;gt; and its descendant.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The host document ==&lt;br /&gt;
&lt;br /&gt;
The document which hosts an external HTML file is called a &amp;quot;host document&amp;quot;.&lt;br /&gt;
Any HTML document can host be a host document. &lt;br /&gt;
&lt;br /&gt;
If author add a &amp;lt;tt&amp;gt;link&amp;lt;/tt&amp;gt; element with its &amp;lt;tt&amp;gt;rel&amp;lt;/tt&amp;gt; attribute set to &amp;lt;tt&amp;gt;component&amp;lt;/tt&amp;gt; to a apge, &lt;br /&gt;
the page hosts the linked HTML resource.&lt;br /&gt;
&lt;br /&gt;
In this example, the document hosts &amp;lt;tt&amp;gt;comment.html&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute ==&lt;br /&gt;
&lt;br /&gt;
Author can add the &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute to confine the component definition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot; confined&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Shared Hosting =&lt;br /&gt;
&lt;br /&gt;
If an author hosts an external HTML without specifying &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute,&lt;br /&gt;
the HTML is hosted as a shared resource. &lt;br /&gt;
That means, agents insert &amp;lt;tt&amp;gt;head&amp;lt;/tt&amp;gt; children of the hosted document&lt;br /&gt;
into the host document&#039;s &amp;lt;tt&amp;gt;head&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Each script execution inside hosted HTML shares the global object with its host document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this example, the host document eventually has an &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element named &amp;lt;tt&amp;gt;x-comment&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- comment.html --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- host document --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
    var shouldNotNull = document.querySelector(&amp;quot;element[name=x-comment]&amp;quot;);&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Confined Hosting =&lt;br /&gt;
&lt;br /&gt;
If an author hosts an external HTML without specifying &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute,&lt;br /&gt;
the HTML is hosted as a confined resource. &lt;br /&gt;
&lt;br /&gt;
A confined resource has its document object. Any scripts inside the confined resource &lt;br /&gt;
are run on its own global object. &lt;br /&gt;
&lt;br /&gt;
Conceptually, a confined resource is similar to a document in a cross-domain frame.&lt;br /&gt;
For example, the script on the confined resource can make a XMLHttpRequest to its own domain, instead of the host domain.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- comment.html --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;script&amp;gt;&lt;br /&gt;
         console.log(document.location.toString()); // prints the url of comment.html &lt;br /&gt;
       &amp;lt;script&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- host document --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot; confined&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Registered Elements in a Confined Resource ==&lt;br /&gt;
&lt;br /&gt;
The host document recognize an element name which is registered in the hosting confined documents, not only&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7523</id>
		<title>Component Model Strawman: Isolation</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7523"/>
		<updated>2011-10-29T00:32:48Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Overview */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The isolated components definition is a &amp;lt;tt&amp;gt;provide&amp;lt;/tt&amp;gt; attributed HTML file which is loaded in separate namespace.&lt;br /&gt;
It is basically a document loaded by an iframe. But it has different way for communicating with the host document.&lt;br /&gt;
&lt;br /&gt;
== Terms ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Confined&#039;&#039;&#039;: disallow a component from accessing the containing page. Useful when a page does not trust the component or its source.&lt;br /&gt;
* &#039;&#039;&#039;Encapsulated&#039;&#039;&#039;: disallow the containing page from accessing the internals of the component. Useful when a component wants to prevent a page from meddling with it.&lt;br /&gt;
* &#039;&#039;&#039;Isolated&#039;&#039;&#039;: a component that is both confined and encapsulated.&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Autonomy ===&lt;br /&gt;
&lt;br /&gt;
Components should be autonomous entities that can be loaded and applied as a single building block. Avoid requiring extensive manipulations on both side of the page &amp;lt;=&amp;gt; component divide.&lt;br /&gt;
&lt;br /&gt;
This will also help in implementing decorators.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
The interface of a component should be minimal and well defined. Embedding pages should not be required (nor able to in the case of encapsulation) to access, or even know about, the internals of a component. Conversely, the function of a component should not depend on being able to access the DOM or any other information of the hosting page that is not provided through an interface.&lt;br /&gt;
&lt;br /&gt;
The component should be able to apply and filter data and styles passed in as it sees fit.&lt;br /&gt;
&lt;br /&gt;
=== Transparency ===&lt;br /&gt;
&lt;br /&gt;
Whether or not a component is isolated should ideally be transparent to both the component and the hosting DOM.&lt;br /&gt;
&lt;br /&gt;
= Loading an External HTML Resource =&lt;br /&gt;
&lt;br /&gt;
The element registration and template definition also can be done in an external, separate HTML resource.&lt;br /&gt;
Author can define a set of elements inside the external HTML and use it in different HTML pages. &lt;br /&gt;
&lt;br /&gt;
Effective markup vocabulary for the external HTML is limited.&lt;br /&gt;
Agents only recognize the first &amp;lt;tt&amp;gt;head element&amp;lt;/tt&amp;gt; and its descendant.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The host document ==&lt;br /&gt;
&lt;br /&gt;
The document which hosts an external HTML file is called a &amp;quot;host document&amp;quot;.&lt;br /&gt;
Any HTML document can host be a host document. &lt;br /&gt;
&lt;br /&gt;
If author add a &amp;lt;tt&amp;gt;link&amp;lt;/tt&amp;gt; element with its &amp;lt;tt&amp;gt;rel&amp;lt;/tt&amp;gt; attribute set to &amp;lt;tt&amp;gt;component&amp;lt;/tt&amp;gt; to a apge, &lt;br /&gt;
the page hosts the linked HTML resource.&lt;br /&gt;
&lt;br /&gt;
In this example, the document hosts &amp;lt;tt&amp;gt;comment.html&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute ==&lt;br /&gt;
&lt;br /&gt;
Author can add the &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute to confine the component definition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot; confined&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Shared Hosting =&lt;br /&gt;
&lt;br /&gt;
If an author hosts an external HTML without specifying &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute,&lt;br /&gt;
the HTML is hosted as a shared resource. &lt;br /&gt;
That means, agents insert &amp;lt;tt&amp;gt;head&amp;lt;/tt&amp;gt; children of the hosted document&lt;br /&gt;
into the host document&#039;s &amp;lt;tt&amp;gt;head&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Each script execution inside hosted HTML shares the global object with its host document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this example, the host document eventually has an &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element named &amp;lt;tt&amp;gt;x-comment&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- comment.html --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- host document --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
    var shouldNotNull = document.querySelector(&amp;quot;element[name=x-comment]&amp;quot;);&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Confined Hosting =&lt;br /&gt;
&lt;br /&gt;
If an author hosts an external HTML without specifying &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute,&lt;br /&gt;
the HTML is hosted as a confined resource. &lt;br /&gt;
&lt;br /&gt;
A confined resource has its document object. Any scripts inside the confined resource &lt;br /&gt;
are run on its own global object. &lt;br /&gt;
&lt;br /&gt;
Conceptually, a confined resource is similar to a document in a cross-domain frame.&lt;br /&gt;
For example, the script on the confined resource can make a XMLHttpRequest to its own domain, instead of the host domain.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- comment.html --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;script&amp;gt;&lt;br /&gt;
         console.log(document.location.toString()); // prints the url of comment.html &lt;br /&gt;
       &amp;lt;script&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- host document --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot; confined&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Registered Elements in a Confined Resource ==&lt;br /&gt;
&lt;br /&gt;
The host document recognize an element name which is registered in the hosting confined documents, not only&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7522</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7522"/>
		<updated>2011-10-29T00:31:38Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Implementation Approaches */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This makes the decorator the &amp;quot;more important&amp;quot; part in the relation. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
[[User:Rolandsteiner|RolandSteiner]] Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
=== Decorating Component Parts ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to have the ability to decorate specific parts of a component. E.g., the caps-lock indicator in an &amp;lt;tt&amp;gt;&amp;amp;lt;input&amp;amp;gt;&amp;lt;/tt&amp;gt; field could be considered a decorator.&lt;br /&gt;
&lt;br /&gt;
However, this clashes with the desire to not make the internals of components public. To reconcile this we&#039;d need a better model of how to declare component parts, whether &amp;quot;aspect-oriented components&amp;quot; or something different.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Binding Approaches =&lt;br /&gt;
&lt;br /&gt;
== CSS ==&lt;br /&gt;
&lt;br /&gt;
=== XBL Approach ===&lt;br /&gt;
&lt;br /&gt;
XBL uses a CSS attribute &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; to assign bindings to elements, as well as allowing elements to add bindings explicitly via &amp;lt;tt&amp;gt;element.addBinding()&amp;lt;/tt&amp;gt;. While XBL specifies implicit bindings, as would be used by decorators, the natural vehicle to apply decorators - CSS - only seems to allow one (?).&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Properties ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS &amp;lt;tt&amp;gt;decorator-&amp;amp;lt;xyz&amp;amp;gt;&amp;lt;/tt&amp;gt; property with the values &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;apply&amp;lt;/tt&amp;gt;. Rules can then switch individual decorators on or off.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* allows decorators to be switched on or off based on rules&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* requires probably controversial CSS extension&lt;br /&gt;
* does not define where decorator is rendered&lt;br /&gt;
* does not allow classification which decorators are applicable to which elements&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Pseudo-elements ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS pseudo-element or - probably better - an ID that can be accessed via a pseudo-element function &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* potentially easier to get acceptance for &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt; than for decorator properties.&lt;br /&gt;
* pseudo-element kinda makes sense, since the decorator can be considered becoming part of the decorated element&lt;br /&gt;
* allows further styling of the decorator&lt;br /&gt;
* classification what decorators can be applied to which elements in the realm of the possible (make &#039;illegal&#039; decorators fail in the CSS selector matching).&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* what are the properties for the pseudo-element?&lt;br /&gt;
* how to turn off a set pseudo-element again?&lt;br /&gt;
&lt;br /&gt;
= Implementation Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;br /&gt;
* (Re-)raises questions about (XBL-like) inheritance, overriding and/or hiding of previously applied shadow trees&lt;br /&gt;
&lt;br /&gt;
== In-between ==&lt;br /&gt;
&lt;br /&gt;
Determine decorators in terms of CSS layout, but define that layout in terms of a DOM and open it up to scripting - e.g., auto-instantiate the DOM when a content-generating pseudo-element is used.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Simplicity of CSS application, but allowing for scripting&lt;br /&gt;
* Details what is currently &amp;quot;hidden&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Performance questions&lt;br /&gt;
* Content-generating pseudo-classes may not fit a single DOM template&lt;br /&gt;
* Defining things in terms of DOM may block future additions to CSS that then would no longer fit that definition (and thus break pages)&lt;br /&gt;
* Performant implementation may require multiple renderers per node&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7521</id>
		<title>Component Model Strawman: Styling</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7521"/>
		<updated>2011-10-29T00:22:13Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Issues and Questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
There are 4 actors that may modify the style of (parts of) a component:&lt;br /&gt;
&lt;br /&gt;
* the browser&lt;br /&gt;
* the component author&lt;br /&gt;
* the page author&lt;br /&gt;
* the user&lt;br /&gt;
&lt;br /&gt;
We intend to use the ShadowScope to be the staging point for component styling&lt;br /&gt;
&lt;br /&gt;
= Specified Styles and Inheritance =&lt;br /&gt;
&lt;br /&gt;
To style the component in a way that meets expectations, we probably need an algorithm similar to the following:&lt;br /&gt;
&lt;br /&gt;
# The shadow root node inherits all styles from the host element&#039;s parent&lt;br /&gt;
# All styles set on the host element (+) all styles set on the shadow root are applied to the shadow root element. To this end, the cascade order is (from least to most important):&lt;br /&gt;
## browser styles&lt;br /&gt;
## user styles&lt;br /&gt;
## component author styles on shadow root&lt;br /&gt;
## page author styles on the host element&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; page author styles on the host element&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; component author styles on the shadow root&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; user styles&lt;br /&gt;
&lt;br /&gt;
= Issues and Questions =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;What does it mean if the host element is assigned, e.g., &amp;lt;tt&amp;gt;display: table&amp;lt;/tt&amp;gt;?&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We could ignore that property value, but that seems rather arbitrary and requires a detailed spec on what is ignored when, how and why. Another (better?) approach could be to define a new value &amp;lt;tt&amp;gt;display: component&amp;lt;/tt&amp;gt;. If this value is set, an element renders as if it was a component - i.e., the element itself is not rendered, nor are its children by default. If it has a component bound to it, it is rendered instead. Otherwise, this is effectively equivalent to &amp;lt;tt&amp;gt;display: none&amp;lt;/tt&amp;gt; (or we could set a different fallback, e.g. &amp;lt;tt&amp;gt;display: inline&amp;lt;/tt&amp;gt;, but IMHO this just complicates things).&lt;br /&gt;
&lt;br /&gt;
To further facilitate this, we can add a pseudo-class &amp;lt;tt&amp;gt;:component&amp;lt;/tt&amp;gt; that matches if the element is a component. With this, the UA stylesheet just needs an entry &amp;lt;tt&amp;gt;:component { display: component }&amp;lt;/tt&amp;gt; to properly render components, while still allowing the page author to override specific elements he doesn&#039;t want to be rendered as components.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;In that case, what does it mean if a generated-content pseudo element such as &amp;lt;tt&amp;gt;::before&amp;lt;/tt&amp;gt; sets &amp;lt;tt&amp;gt;display: component&amp;lt;/tt&amp;gt;?&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
We can either ignore this and treat it as equivalent to &amp;lt;tt&amp;gt;display: none&amp;lt;/tt&amp;gt; - the generated content does not have a component assigned to it after all - or use that as a staging point for decorators somehow.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7520</id>
		<title>Component Model Strawman: Isolation</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7520"/>
		<updated>2011-10-28T22:54:11Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The isolated components definition is a &amp;lt;tt&amp;gt;provide&amp;lt;/tt&amp;gt; attributed HTML file which is loaded in separate namespace.&lt;br /&gt;
It is basically a document loaded by an iframe. But it has different way for communicating with the host document.&lt;br /&gt;
&lt;br /&gt;
See also the &amp;quot;Isolation&amp;quot; section on [[Component_Model_Strawman:_Declarative_Syntax]].&lt;br /&gt;
&lt;br /&gt;
== Terms ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Confined&#039;&#039;&#039;: disallow a component from accessing the containing page. Useful when a page does not trust the component or its source.&lt;br /&gt;
* &#039;&#039;&#039;Encapsulated&#039;&#039;&#039;: disallow the containing page from accessing the internals of the component. Useful when a component wants to prevent a page from meddling with it.&lt;br /&gt;
* &#039;&#039;&#039;Isolated&#039;&#039;&#039;: a component that is both confined and encapsulated.&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Autonomy ===&lt;br /&gt;
&lt;br /&gt;
Components should be autonomous entities that can be loaded and applied as a single building block. Avoid requiring extensive manipulations on both side of the page &amp;lt;=&amp;gt; component divide.&lt;br /&gt;
&lt;br /&gt;
This will also help in implementing decorators.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
The interface of a component should be minimal and well defined. Embedding pages should not be required (nor able to in the case of encapsulation) to access, or even know about, the internals of a component. Conversely, the function of a component should not depend on being able to access the DOM or any other information of the hosting page that is not provided through an interface.&lt;br /&gt;
&lt;br /&gt;
The component should be able to apply and filter data and styles passed in as it sees fit.&lt;br /&gt;
&lt;br /&gt;
=== Transparency ===&lt;br /&gt;
&lt;br /&gt;
Whether or not a component is isolated should ideally be transparent to both the component and the hosting DOM.&lt;br /&gt;
&lt;br /&gt;
= Loading an External HTML Resource =&lt;br /&gt;
&lt;br /&gt;
The element registration and template definition also can be done in an external, separate HTML resource.&lt;br /&gt;
Author can define a set of elements inside the external HTML and use it in different HTML pages. &lt;br /&gt;
&lt;br /&gt;
Effective markup vocabulary for the external HTML is limited.&lt;br /&gt;
Agents only recognize the first &amp;lt;tt&amp;gt;head element&amp;lt;/tt&amp;gt; and its descendant.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The host document ==&lt;br /&gt;
&lt;br /&gt;
The document which hosts an external HTML file is called a &amp;quot;host document&amp;quot;.&lt;br /&gt;
Any HTML document can host be a host document. &lt;br /&gt;
&lt;br /&gt;
If author add a &amp;lt;tt&amp;gt;link&amp;lt;/tt&amp;gt; element with its &amp;lt;tt&amp;gt;rel&amp;lt;/tt&amp;gt; attribute set to &amp;lt;tt&amp;gt;component&amp;lt;/tt&amp;gt; to a apge, &lt;br /&gt;
the page hosts the linked HTML resource.&lt;br /&gt;
&lt;br /&gt;
In this example, the document hosts &amp;lt;tt&amp;gt;comment.html&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute ==&lt;br /&gt;
&lt;br /&gt;
Author can add the &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute to confine the component definition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot; confined&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Shared Hosting =&lt;br /&gt;
&lt;br /&gt;
If an author hosts an external HTML without specifying &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute,&lt;br /&gt;
the HTML is hosted as a shared resource. &lt;br /&gt;
That means, agents insert &amp;lt;tt&amp;gt;head&amp;lt;/tt&amp;gt; children of the hosted document&lt;br /&gt;
into the host document&#039;s &amp;lt;tt&amp;gt;head&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Each script execution inside hosted HTML shares the global object with its host document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this example, the host document eventually has an &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element named &amp;lt;tt&amp;gt;x-comment&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- comment.html --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- host document --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
    var shouldNotNull = document.querySelector(&amp;quot;element[name=x-comment]&amp;quot;);&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Confined Hosting =&lt;br /&gt;
&lt;br /&gt;
If an author hosts an external HTML without specifying &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute,&lt;br /&gt;
the HTML is hosted as a confined resource. &lt;br /&gt;
&lt;br /&gt;
A confined resource has its document object. Any scripts inside the confined resource &lt;br /&gt;
are run on its own global object. &lt;br /&gt;
&lt;br /&gt;
Conceptually, a confined resource is similar to a document in a cross-domain frame.&lt;br /&gt;
For example, the script on the confined resource can make a XMLHttpRequest to its own domain, instead of the host domain.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- comment.html --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;script&amp;gt;&lt;br /&gt;
         console.log(document.location.toString()); // prints the url of comment.html &lt;br /&gt;
       &amp;lt;script&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- host document --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot; confined&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Registered Elements in a Confined Resource ==&lt;br /&gt;
&lt;br /&gt;
The host document recognize an element name which is registered in the hosting confined documents, not only&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7519</id>
		<title>Component Model Strawman: Isolation</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7519"/>
		<updated>2011-10-28T22:53:51Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: add Overview and Considerations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The isolated components definition is a &amp;lt;tt&amp;gt;provide&amp;lt;/tt&amp;gt; attributed HTML file which is loaded in separate namespace.&lt;br /&gt;
It is basically a document loaded by an iframe. But it has different way for communicating with the host document.&lt;br /&gt;
&lt;br /&gt;
See also the &amp;quot;Isolation&amp;quot; section on [[Component_Model_Strawman:_Declarative_Syntax]].&lt;br /&gt;
&lt;br /&gt;
== Terms ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Confined&#039;&#039;&#039;: disallow a component from accessing the containing page. Useful when a page does not trust the component or its source.&lt;br /&gt;
* &#039;&#039;&#039;Encapsulated&#039;&#039;&#039;: disallow the containing page from accessing the internals of the component. Useful when a component wants to prevent a page from meddling with it.&lt;br /&gt;
* &#039;&#039;&#039;Isolated&#039;&#039;&#039;: a component that is both confined and encapsulated.&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Autonomy ===&lt;br /&gt;
&lt;br /&gt;
Components should be autonomous entities that can be loaded and applied as a single building block. Avoid requiring extensive manipulations on both side of the page &amp;lt;=&amp;gt; component divide.&lt;br /&gt;
&lt;br /&gt;
This will also help in implementing decorators.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
The interface of a component should be minimal and well defined. Embedding pages should not be required (nor able to in the case of encapsulation) to access, or even know about, the internals of a component. Conversely, the function of a component should not depend on being able to access the DOM or any other information of the hosting page that is not provided through an interface.&lt;br /&gt;
&lt;br /&gt;
The component should be able to apply and filter data and styles passed in as it sees fit.&lt;br /&gt;
&lt;br /&gt;
=== Transparency ===&lt;br /&gt;
&lt;br /&gt;
Whether or not a component is isolated should ideally be transparent to both the component and the hosting DOM.&lt;br /&gt;
&lt;br /&gt;
= Approaches =&lt;br /&gt;
&lt;br /&gt;
= Loading an External HTML Resource =&lt;br /&gt;
&lt;br /&gt;
The element registration and template definition also can be done in an external, separate HTML resource.&lt;br /&gt;
Author can define a set of elements inside the external HTML and use it in different HTML pages. &lt;br /&gt;
&lt;br /&gt;
Effective markup vocabulary for the external HTML is limited.&lt;br /&gt;
Agents only recognize the first &amp;lt;tt&amp;gt;head element&amp;lt;/tt&amp;gt; and its descendant.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The host document ==&lt;br /&gt;
&lt;br /&gt;
The document which hosts an external HTML file is called a &amp;quot;host document&amp;quot;.&lt;br /&gt;
Any HTML document can host be a host document. &lt;br /&gt;
&lt;br /&gt;
If author add a &amp;lt;tt&amp;gt;link&amp;lt;/tt&amp;gt; element with its &amp;lt;tt&amp;gt;rel&amp;lt;/tt&amp;gt; attribute set to &amp;lt;tt&amp;gt;component&amp;lt;/tt&amp;gt; to a apge, &lt;br /&gt;
the page hosts the linked HTML resource.&lt;br /&gt;
&lt;br /&gt;
In this example, the document hosts &amp;lt;tt&amp;gt;comment.html&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute ==&lt;br /&gt;
&lt;br /&gt;
Author can add the &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute to confine the component definition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot; confined&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Shared Hosting =&lt;br /&gt;
&lt;br /&gt;
If an author hosts an external HTML without specifying &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute,&lt;br /&gt;
the HTML is hosted as a shared resource. &lt;br /&gt;
That means, agents insert &amp;lt;tt&amp;gt;head&amp;lt;/tt&amp;gt; children of the hosted document&lt;br /&gt;
into the host document&#039;s &amp;lt;tt&amp;gt;head&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Each script execution inside hosted HTML shares the global object with its host document.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In this example, the host document eventually has an &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element named &amp;lt;tt&amp;gt;x-comment&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- comment.html --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- host document --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
    var shouldNotNull = document.querySelector(&amp;quot;element[name=x-comment]&amp;quot;);&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Confined Hosting =&lt;br /&gt;
&lt;br /&gt;
If an author hosts an external HTML without specifying &amp;lt;tt&amp;gt;confined&amp;lt;/tt&amp;gt; attribute,&lt;br /&gt;
the HTML is hosted as a confined resource. &lt;br /&gt;
&lt;br /&gt;
A confined resource has its document object. Any scripts inside the confined resource &lt;br /&gt;
are run on its own global object. &lt;br /&gt;
&lt;br /&gt;
Conceptually, a confined resource is similar to a document in a cross-domain frame.&lt;br /&gt;
For example, the script on the confined resource can make a XMLHttpRequest to its own domain, instead of the host domain.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- comment.html --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element name=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
       &amp;lt;script&amp;gt;&lt;br /&gt;
         console.log(document.location.toString()); // prints the url of comment.html &lt;br /&gt;
       &amp;lt;script&amp;gt;&lt;br /&gt;
    &amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- host document --&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot; confined&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Registered Elements in a Confined Resource ==&lt;br /&gt;
&lt;br /&gt;
The host document recognize an element name which is registered in the hosting confined documents, not only&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7484</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7484"/>
		<updated>2011-10-27T00:07:54Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This makes the decorator the &amp;quot;more important&amp;quot; part in the relation. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
[[User:Rolandsteiner|RolandSteiner]] Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
=== Decorating Component Parts ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to have the ability to decorate specific parts of a component. E.g., the caps-lock indicator in an &amp;lt;tt&amp;gt;&amp;amp;lt;input&amp;amp;gt;&amp;lt;/tt&amp;gt; field could be considered a decorator.&lt;br /&gt;
&lt;br /&gt;
However, this clashes with the desire to not make the internals of components public. To reconcile this we&#039;d need a better model of how to declare component parts, whether &amp;quot;aspect-oriented components&amp;quot; or something different.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Binding Approaches =&lt;br /&gt;
&lt;br /&gt;
== CSS ==&lt;br /&gt;
&lt;br /&gt;
=== XBL Approach ===&lt;br /&gt;
&lt;br /&gt;
XBL uses a CSS attribute &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; to assign bindings to elements, as well as allowing elements to add bindings explicitly via &amp;lt;tt&amp;gt;element.addBinding()&amp;lt;/tt&amp;gt;. While XBL specifies implicit bindings, as would be used by decorators, the natural vehicle to apply decorators - CSS - only seems to allow one (?).&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Properties ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS &amp;lt;tt&amp;gt;decorator-&amp;amp;lt;xyz&amp;amp;gt;&amp;lt;/tt&amp;gt; property with the values &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;apply&amp;lt;/tt&amp;gt;. Rules can then switch individual decorators on or off.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* allows decorators to be switched on or off based on rules&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* requires probably controversial CSS extension&lt;br /&gt;
* does not define where decorator is rendered&lt;br /&gt;
* does not allow classification which decorators are applicable to which elements&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Pseudo-elements ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS pseudo-element or - probably better - an ID that can be accessed via a pseudo-element function &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* potentially easier to get acceptance for &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt; than for decorator properties.&lt;br /&gt;
* pseudo-element kinda makes sense, since the decorator can be considered becoming part of the decorated element&lt;br /&gt;
* allows further styling of the decorator&lt;br /&gt;
* classification what decorators can be applied to which elements in the realm of the possible (make &#039;illegal&#039; decorators fail in the CSS selector matching).&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* what are the properties for the pseudo-element?&lt;br /&gt;
* how to turn off a set pseudo-element again?&lt;br /&gt;
&lt;br /&gt;
= Implementation Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7477</id>
		<title>Component Model Strawman: Styling</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7477"/>
		<updated>2011-10-26T20:29:35Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: Styling part 1&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
There are 4 actors that may modify the style of (parts of) a component:&lt;br /&gt;
&lt;br /&gt;
* the browser&lt;br /&gt;
* the component author&lt;br /&gt;
* the page author&lt;br /&gt;
* the user&lt;br /&gt;
&lt;br /&gt;
We intend to use the ShadowScope to be the staging point for component styling&lt;br /&gt;
&lt;br /&gt;
= Specified Styles and Inheritance =&lt;br /&gt;
&lt;br /&gt;
To style the component in a way that meets expectations, we probably need an algorithm similar to the following:&lt;br /&gt;
&lt;br /&gt;
# The shadow root node inherits all styles from the host element&#039;s parent&lt;br /&gt;
# All styles set on the host element (+) all styles set on the shadow root are applied to the shadow root element. To this end, the cascade order is (from least to most important):&lt;br /&gt;
## browser styles&lt;br /&gt;
## user styles&lt;br /&gt;
## component author styles on shadow root&lt;br /&gt;
## page author styles on the host element&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; page author styles on the host element&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; component author styles on the shadow root&lt;br /&gt;
## &amp;lt;tt&amp;gt;!important&amp;lt;/tt&amp;gt; user styles&lt;br /&gt;
&lt;br /&gt;
= Issues and Questions =&lt;br /&gt;
&lt;br /&gt;
* What does it mean if the host element is assigned, e.g., &amp;lt;tt&amp;gt;display: table&amp;lt;/tt&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
We could ignore that property value, but that seems rather arbitrary and requires a detailed spec on what is ignored when, how and why. Another (better?) approach could be to define a new value &amp;lt;tt&amp;gt;display: component&amp;lt;/tt&amp;gt;. If this value is set, an element renders as if it was a component - i.e., the element itself is not rendered, nor are its children by default. If it has a component bound to it, it is rendered instead. Otherwise, this is effectively equivalent to &amp;lt;tt&amp;gt;display: none&amp;lt;/tt&amp;gt; (or we could set a different fallback, e.g. &amp;lt;tt&amp;gt;display: inline&amp;lt;/tt&amp;gt;, but IMHO this just complicates things).&lt;br /&gt;
&lt;br /&gt;
To further facilitate this, we can add a pseudo-class &amp;lt;tt&amp;gt;:component&amp;lt;/tt&amp;gt; that matches if the element is a component. With this, the UA stylesheet just needs an entry &amp;lt;tt&amp;gt;:component { display: component }&amp;lt;/tt&amp;gt; to properly render components, while still allowing the page author to override specific elements he doesn&#039;t want to be rendered as components.&lt;br /&gt;
&lt;br /&gt;
** In that case, what does it mean if a generated-content pseudo element such as &amp;lt;tt&amp;gt;::before&amp;lt;/tt&amp;gt; sets &amp;lt;tt&amp;gt;display: component&amp;lt;/tt&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
We can either ignore this and treat it as equivalent to &amp;lt;tt&amp;gt;display: none&amp;lt;/tt&amp;gt; - the generated content does not have a component assigned to it after all - or use that as a staging point for decorators somehow.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Decorators&amp;diff=7471</id>
		<title>Component Model Strawman: Decorators</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Decorators&amp;diff=7471"/>
		<updated>2011-10-26T20:10:11Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;see also the [http://wiki.whatwg.org/wiki/Component_Model_Decorator_Brainstorming brainstorming page].&lt;br /&gt;
&lt;br /&gt;
Stub&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7470</id>
		<title>Component Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7470"/>
		<updated>2011-10-26T20:09:35Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here&#039;s a good starting point for learning about the [https://github.com/dglazkov/component-model component model spec], which is being developed by applying a [[Component_Model_Methodology | defined methodology]].&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Component Model&#039;&#039;&#039; introduces comprehensive support for creating DOM elements. [[Component_Model_Use_Cases | Examples]] include layout managers, combinations of Dojo and jQuery widgets, isolated widgets, such as Like/+1 buttons, and built-in HTML elements themselves.  Reflecting on the experience of Mozilla&#039;s XBL  and Microsoft Internet Explorer&#039;s HTML components, the Component Model formalizes the concept of loosely coupled, coherent units of [[Behavior Attachment | behavior]]  in the [http://www.w3.org/wiki/Open_Web_Platform Web platform]. The functionality goals of the Component Model resemble  the goals of [http://dev.w3.org/2006/xbl2/ XBL2]; unlike XBL2, the Component Model seeks to be more incremental and modular while leveraging and integrating with new technologies.&lt;br /&gt;
&lt;br /&gt;
Strawman pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Decorators Decorators]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Element_Registration Element Registration]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Declarative_Syntax Declarative Syntax]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Styling Styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Isolation Isolation]&lt;br /&gt;
&lt;br /&gt;
Related links:&lt;br /&gt;
&lt;br /&gt;
* [[Behavior_Attachment | Behavior Attachment]] -- a general overview of the behavior attachment problem&lt;br /&gt;
* [[Component_Model_Methodology | Component Model Methodology]]&lt;br /&gt;
* [[Component_Model_Use_Cases | Component Model Use Cases]]&lt;br /&gt;
* [[Component_Model_Declarative_Syntax | Component Model Declarative Syntax]]&lt;br /&gt;
* [https://github.com/dglazkov/component-model Component Model Spec on Github]&lt;br /&gt;
* [http://dglazkov.github.com/component-model/ Component Model Spec Snapshot on Github Pages]&lt;br /&gt;
* [[Component_Model_Progressive_Enhancement | Component Model Progressive Enhancement]]&lt;br /&gt;
* [[Custom_Tags_Analysis | Custom Tags Analysis]]&lt;br /&gt;
&lt;br /&gt;
Discussion pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion Main discussion page with open questions]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion:_Rendering Rendering-specific discussion]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_CSS_Brainstorming brainstorming page about CSS and styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Isolation_Brainstorming brainstorming page about isolation and confinement]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Decorator_Brainstorming brainstorming page about decorators]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_IDL_Brainstorming brainstorming page about IDLs and communication across boundaries]&lt;br /&gt;
&lt;br /&gt;
=Properties=&lt;br /&gt;
&lt;br /&gt;
The component model aims to satisfy several key properties. These properties were extracted from the [[Component_Model_Use_Cases | use cases]]. This section explains component model basics by studying each property.&lt;br /&gt;
&lt;br /&gt;
==Extensibility==&lt;br /&gt;
&lt;br /&gt;
The component model enables creation of new types of DOM elements by allowing the use of existing DOM elements in JavaScript prototype chain. For example, here&#039;s how you would create a new sub-type of HTMLElement:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
LayoutManagerPanel.prototype = Object.create(HTMLElement.prototype);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
// 1) Will not be able to add instances of LayoutManagerPanel to document without this call.&lt;br /&gt;
// 2) First parameter specifies the tagName of the element being registered and must be a string prefixed with &amp;quot;x-&amp;quot;.&lt;br /&gt;
Element.register(&amp;quot;x-layout-manager-panel&amp;quot;, LayoutManagerPanel);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
var panel = new LayoutManagerPanel();&lt;br /&gt;
document.body.appendChild(panel);&lt;br /&gt;
// or&lt;br /&gt;
document.body.innerHTML = &amp;quot;&amp;lt;x-layout-manager-panel&amp;gt;&amp;lt;/x-layout-manager-panel&amp;gt;&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt; instance is a Javascript object that is a valid DOM element, which can be added to the DOM tree. You can then extend this object using standard Javascript prototype inheritance.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
==Consistency==&lt;br /&gt;
&lt;br /&gt;
Because components are just DOM objects, they inherently share the same traversal and manipulation APIs, as defined by the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html DOM4]. The authors of components can extend these APIs by adding custom methods and properties on DOM objects, using standard JavaScript inheritance:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Widget.prototype = Object.create(HTMLElement.prototype, {&lt;br /&gt;
    update: {&lt;br /&gt;
        value: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
    value: {&lt;br /&gt;
        get: function() { /* ... */ },&lt;br /&gt;
        set: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
   // ...&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The common API surface and the ability to extend it serves as a natural API boundary for framework authors, enabling interoperability.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
&lt;br /&gt;
==Encapsulation==&lt;br /&gt;
Encapsulation refers to ability of the component to hide its implementation details and state from the document. To enable hiding of the implementation details, the component model provides a way to build a DOM tree that is not accessible from the document DOM tree, but is rendered as part of the document. This DOM tree, associated with the component is the [http://glazkov.com/2011/01/14/what-the-heck-is-shadow-dom/ shadow DOM]. The boundary between the document DOM tree and shadow DOM tree provides complete encapsulation, and ensures that:&lt;br /&gt;
* no shadow DOM tree nodes cross this boundary during event dispatch;&lt;br /&gt;
* document DOM tree has no access to nodes in the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Additionally, the boundary serves as a convenient style application lever, giving the component a choice of letting (or not letting) document CSS affect the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Every DOM element instance may only have (or &#039;&#039;host&#039;&#039;) one shadow DOM tree. A shadow tree is instantiated by creating an instance of the &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; object, which takes a reference to the hosting element as a parameter. Attempting to create more than one instance for the same element throws an exception:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
    var shadow = new ShadowRoot(this);&lt;br /&gt;
    var shadow2 = new ShadowRoot(this); // throws an exception.&lt;br /&gt;
   // ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
&lt;br /&gt;
==Composability==&lt;br /&gt;
&lt;br /&gt;
Being DOM objects, components fit naturally into the document DOM tree and support all of its composition properties. In addition, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element allows controlling interaction between shadow and document DOM trees. A &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element specifies places where immediate document tree children of the component are rendered &#039;&#039;inside&#039;&#039; the shadow tree.&lt;br /&gt;
&lt;br /&gt;
There can be more than one &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element in the shadow tree. The &amp;lt;code&amp;gt;includes&amp;lt;/code&amp;gt; attribute provides a convenient way to sort element&#039;s children by CSS selector. For example, a &amp;lt;code&amp;gt;DockLayoutPanel&amp;lt;/code&amp;gt; component could be used like this in the document DOM tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Chauncey Gardiner.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Provided that its shadow DOM tree looks like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content includes=&amp;amp;quot;.west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The document DOM tree children on of &amp;lt;code&amp;gt;x-dock-layout-panel&amp;lt;/code&amp;gt; will be rendered as if composed from this tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Avid Gardener.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Desugaring==&lt;br /&gt;
The component model also explains pretty well how the native HTML elements are built and dispels some of the magic associated with the &amp;quot;DOM object vs. JavaScript object&amp;quot; juxtaposition.&lt;br /&gt;
&lt;br /&gt;
Allowing DOM elements to participate in the JavaScript inheritance chain makes DOM elements more approachable and easier to work with.&lt;br /&gt;
&lt;br /&gt;
Complex DOM elements that are rendered with more than one CSS box (and aren&#039;t specified in terms of CSS, like [http://dev.w3.org/csswg/css3-lists/ lists]) are just components that have shadow DOM. Coincidentally, this also explains why you can&#039;t add shadow DOM subtrees to &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;details&amp;lt;/code&amp;gt; elements -- their &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;s are claimed by &amp;lt;code&amp;gt;HTMLInputElement&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;HTMLDetailsElement&amp;lt;/code&amp;gt; constructors, respectively.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
Considering the way Web works, the component model must allow decoupling of the instantiation and the declaration of the components in order to provide reasonable performance characteristics. It&#039;s an unfortunate, but necessary requirement. In other words, we must be able to handle situations where a component instance is created before it is declared. Here&#039;s an simple example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// somewhere in view.js&lt;br /&gt;
...&lt;br /&gt;
document.body.innerHTML = &#039;&amp;lt;div class=&amp;quot;awesome&amp;quot;&amp;gt;&amp;lt;x-layout&amp;gt;&amp;lt;x-spring-panel&amp;gt;...&amp;lt;/x-spring-panel&amp;gt;&amp;lt;/x-layout&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
// somewhere in layout.js&lt;br /&gt;
Element.register(&#039;x-layout&#039;, Layout);&lt;br /&gt;
Element.register(&#039;x-spring-panel&#039;, SpringPanel);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this situation, there is no room for error: &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt; &#039;&#039;must&#039;&#039; wait for &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; to load before executing. You can&#039;t load &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; lazily or in any different order, since it defines the components that are used in &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt;. Given that asynchronous, deferred or lazy-loading of script are all common performance techniques in today&#039;s Web, we must do better than block or throw an exception in such cases.&lt;br /&gt;
&lt;br /&gt;
The component model offers this solution:&lt;br /&gt;
&lt;br /&gt;
When an unknown DOM element with an &amp;quot;x-&amp;quot;-prefixed &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt; is encountered, we put a placeholder &amp;lt;code&amp;gt;HTMLUnknownElement&amp;lt;/code&amp;gt; instance in its place. As soon as the element is defined, all placeholder instances are replaced ([http://www.w3.org/TR/DOM-Level-3-Core/core.html#Document3-renameNode Document.renameNode]) with the new, proper DOM element.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
== Confinement ==&lt;br /&gt;
Confinement refers to the document protecting its implementation details and state from the component and can be viewed as the inverse of [[#Encapsulation | encapsulation]].&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks=&lt;br /&gt;
&lt;br /&gt;
The component model is comprised of the following building blocks.&lt;br /&gt;
&lt;br /&gt;
==Shadow DOM==&lt;br /&gt;
&lt;br /&gt;
Any DOM element can host a shadow DOM subtree. The shadow DOM subtree originates at &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;, which is coupled the hosting element at the time of its construction. You don&#039;t need any other building blocks in order to take advantage of the shadow DOM:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var element = document.createElement(&amp;quot;div&amp;quot;);&lt;br /&gt;
var shadow = new ShadowRoot(element);&lt;br /&gt;
shadow.appendChild(document.createElement(&amp;quot;p&amp;quot;)).textContent = &amp;quot;weee!!&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; instance is a [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-node Node], and acts as the root of the element&#039;s shadow DOM subtree. The &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; itself is never rendered, nor has styles. In this regard, it&#039;s similar to the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-documentfragment DocumentFragment]. It has two properties:&lt;br /&gt;
* &amp;lt;code&amp;gt;applyAuthorSheets&amp;lt;/code&amp;gt;, which is either &#039;&#039;&#039;true&#039;&#039;&#039; (that is, apply author style sheets from the document), or &#039;&#039;&#039;false&#039;&#039;&#039; (don&#039;t);&lt;br /&gt;
* &amp;lt;code&amp;gt;shadowHost&amp;lt;/code&amp;gt;, which points to the hosting element.&lt;br /&gt;
&lt;br /&gt;
==Content Element==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element is used with [[#Shadow_DOM | Shadow DOM]] and provides a mechanism for distributing hosting element&#039;s children inside of its shadow subtree. To preserve the [[#Encapsulation | encapsulation]] property, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; elements act as insertion points and do not leak any information about hosting element&#039;s children to the shadow DOM subtree or vise versa.&lt;br /&gt;
&lt;br /&gt;
==Constructable DOM Types==&lt;br /&gt;
The inability to construct DOM element using &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt; (with some exceptions) or use them in the prototype inheritance chain had confounded many Web developers since the beginning of DOM. This building block intends to rectify at least the latter by allowing &amp;lt;code&amp;gt;HTMLElement.call&amp;lt;/code&amp;gt; invocation and thus enabling creation of JavaScript objects with DOM elements in the prototype chain.&lt;br /&gt;
&lt;br /&gt;
==Registering Elements==&lt;br /&gt;
Working in conjunction with  [[#Constructable_DOM_Types | Constructable DOM Types]], this building block makes the list of valid markup tag names extensible by exposing &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
partial interface Element {&lt;br /&gt;
    static void register(in String tagName, in Function constructor);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to envisage a milder (though less elegant) version of element registration by keeping DOM element construction magical (thus decoupling it from [[#Constructable_DOM_Types | Constructable DOM Types]]) and making &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; use a callback, rather than &amp;lt;code&amp;gt;constructor&amp;lt;/code&amp;gt; as parameter. The callback would be invoked with an already-constructed DOM object with the specified &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt;, leaving the work of setting up properties on this object to the callback.&lt;br /&gt;
&lt;br /&gt;
==Confinement Primitives==&lt;br /&gt;
&lt;br /&gt;
The API surface of the component model lends itself well to proper confinement. Here&#039;s an approach that could be used to provide it (very early brainstorming):&lt;br /&gt;
&lt;br /&gt;
* Confinement is not tied to the component model. Instead, it&#039;s a new twist on the method of loading scripts. A script could be loaded as usual or it could be &#039;&#039;confined&#039;&#039;, or loaded into its own context.&lt;br /&gt;
&lt;br /&gt;
* When confined, a script has its own global and document objects. These objects only reveal some safe limited subset of the actual document objects.  Think of it as a same-origin iframe with restrictions on document and window.&lt;br /&gt;
&lt;br /&gt;
* You can communicate with the main document using &amp;lt;code&amp;gt;window.postMessage&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* The confined document DOM tree is always empty. Attempting to insert into it throws exceptions.&lt;br /&gt;
&lt;br /&gt;
* ... except when you append to elements in shadow DOM. That&#039;s right, you can do &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;new ShadowRoot&amp;lt;/code&amp;gt; in the confined document.&lt;br /&gt;
&lt;br /&gt;
* Whenever you register an element, it registers &#039;&#039;in the main document&#039;&#039; as well. Creating an instance of a component from an confined document produces a functional DOM element shell that proxies to the actual element in the confined document.&lt;br /&gt;
&lt;br /&gt;
Proposed API: introduce a new &amp;lt;code&amp;gt;confined&amp;lt;/code&amp;gt; attribute to the &amp;lt;code&amp;gt;script&amp;lt;/code&amp;gt; element. Presence of this attribute triggers loading scripts in the confined context.&lt;br /&gt;
&lt;br /&gt;
Confinement of script execution could be useful outside of the component model and also could be related to [https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html Content Security Policy].&lt;br /&gt;
&lt;br /&gt;
* [[Component_Model_Isolation_Brainstorming | Isolation Brainstorm]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks Use Case Coverage=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of building blocks, tabulated against the [[Component_Model_Use_Cases | use cases]] and approximate percentage of satisfying them:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | Building Block&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Layout_Manager | Layout Manager]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Widget_Mix-and-Match | Mix-and-Match]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Rendering_Form_Controls_with_SVG | SVG Controls]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Contacts_Widget | Contacts Widget]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Like.2F.2B1_Button | Like/+1 Button]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Media_Controls_For_The_Video_Element | Media Controls for the Video Element]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Details.2FSummary_Elements | Details/Summary Element]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| 34%&lt;br /&gt;
| 100%&lt;br /&gt;
| 25%&lt;br /&gt;
| 100%&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Content_Element | Content Element]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Registering_Elements | Registering Elements]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Comparison With Existing Specs and Implementations=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a brief overview of existing similar specifications and implementations:&lt;br /&gt;
* [http://msdn.microsoft.com/en-us/library/ms531018(v=vs.85).aspx HTML Components] is a [http://windows.microsoft.com/en-US/internet-explorer/products/ie/home Microsoft Internet Explorer]-specific method of creating custom DOM elements. Also see [http://www.w3.org/TR/NOTE-HTMLComponents HTML Components Note] (implemented in IE5+).&lt;br /&gt;
* [http://www.w3.org/TR/2001/NOTE-xbl-20010223/ XBL], currently implemented in Mozilla.&lt;br /&gt;
* [http://dev.w3.org/2006/xbl2/ XBL2], the ancestral spec of the Component Model, and a revision of XBL.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a handy overview of how each of these specs satisfies the component model [[#Properties | properties]]:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | Spec/Implementation&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Extensibility | Extensibility]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Consistency | Consistency]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Encapsulation | Encapsulation]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Composability | Composability]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Desugaring | Desugaring]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Performance | Performance]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Confinement | Confinement]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | HTML Components&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Components are magic, inextensible objects.&lt;br /&gt;
| &#039;&#039;&#039;Almost&#039;&#039;&#039;. Implementation provides ways to add properties, methods, events to element API, and the components are &#039;&#039;almost&#039;&#039; DOM elements. However, custom tags don&#039;t support all properties of a DOM element.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. There are some provisions for event encapsulation, nothing else.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. No provisions for handling document children vs. component-defined children.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The mechanism for extending bindings is entirely independent of DOM type or Javascript extensibility.&lt;br /&gt;
| &#039;&#039;&#039;Yes-ish&#039;&#039;&#039;. Bindings can override properties on the DOM element, although the mechanism is highly unnatural (XML declarations).&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;? Hard to say looking at TR note.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;. Some HTML elements in Gecko are implemented using it.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL2&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Same as XBL.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Bindings are discouraged from establishing an API surface on a bound element.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The spec didn&#039;t intend to describe how native elements are built.&lt;br /&gt;
| &#039;&#039;&#039;Somewhat&#039;&#039;&#039;. The lifecycle of a binding is well-defined and initialization stages are well-decoupled. However, there is no way to build a binding imperatively without loading a binding document.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The key differences between XBL2 and the Component Model are:&lt;br /&gt;
* The Component Model fully embraces the [[Behavior_Attachment#Behavior_Attachment_Methods | element behavior attachment]] by allowing creation of new types of DOM elements within a document. This is something Web Framework developers always wanted and repeatedly try to do with parallel object hierarchies. Eliminating ephemerality of the attachment simplifies and clarifies how things work conceptually -- there is no longer a place for &amp;quot;spooky action at a distance&amp;quot;, caused by a change of a random CSS selector or even removing an element from the tree.&lt;br /&gt;
* The Component Model is strongly biased toward reusing existing bits of the platform and well-established techniques instead of inventing new ones. For instance, instead of bindings inheritance, we rely on prototype inheritance. Instead of endeavoring to solve the incredibly complex, yet dubious problem of multiple bindings or shadow DOM trees, we simply suggest composition.&lt;br /&gt;
* The Component Model strives to add capabilities in layers (see [[#Building_Blocks | building blocks]]), each able to function on its own. The omnibus nature of XBL2 removes opportunities for layering, particularly as element identity, life cycle, and scripting are concerned. Perhaps this could be repaired somehow, but Component Model solves these issues without further complicating an already large, difficult to understand spec.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7469</id>
		<title>Component Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7469"/>
		<updated>2011-10-26T20:09:07Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Introduction */ add link to decorators brainstorming page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here&#039;s a good starting point for learning about the [https://github.com/dglazkov/component-model component model spec], which is being developed by applying a [[Component_Model_Methodology | defined methodology]].&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Component Model&#039;&#039;&#039; introduces comprehensive support for creating DOM elements. [[Component_Model_Use_Cases | Examples]] include layout managers, combinations of Dojo and jQuery widgets, isolated widgets, such as Like/+1 buttons, and built-in HTML elements themselves.  Reflecting on the experience of Mozilla&#039;s XBL  and Microsoft Internet Explorer&#039;s HTML components, the Component Model formalizes the concept of loosely coupled, coherent units of [[Behavior Attachment | behavior]]  in the [http://www.w3.org/wiki/Open_Web_Platform Web platform]. The functionality goals of the Component Model resemble  the goals of [http://dev.w3.org/2006/xbl2/ XBL2]; unlike XBL2, the Component Model seeks to be more incremental and modular while leveraging and integrating with new technologies.&lt;br /&gt;
&lt;br /&gt;
Strawman pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Decorators Decorators]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Element_Registration Element Registration]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Declarative_Syntax Declarative Syntax]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Styling Styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Isolation Isolation]&lt;br /&gt;
&lt;br /&gt;
Related links:&lt;br /&gt;
&lt;br /&gt;
* [[Behavior_Attachment | Behavior Attachment]] -- a general overview of the behavior attachment problem&lt;br /&gt;
* [[Component_Model_Methodology | Component Model Methodology]]&lt;br /&gt;
* [[Component_Model_Use_Cases | Component Model Use Cases]]&lt;br /&gt;
* [[Component_Model_Declarative_Syntax | Component Model Declarative Syntax]]&lt;br /&gt;
* [https://github.com/dglazkov/component-model Component Model Spec on Github]&lt;br /&gt;
* [http://dglazkov.github.com/component-model/ Component Model Spec Snapshot on Github Pages]&lt;br /&gt;
* [[Component_Model_Progressive_Enhancement | Component Model Progressive Enhancement]]&lt;br /&gt;
* [[Custom_Tags_Analysis | Custom Tags Analysis]]&lt;br /&gt;
&lt;br /&gt;
Discussion pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion Main discussion page with open questions]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion:_Rendering Rendering-specific discussion]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_CSS_Brainstorming brainstorming page about CSS and styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Isolation_Brainstorming brainstorming page about isolation and confinement]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Decorator_Brainstorming brainstorming page on decorators]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_IDL_Brainstorming brainstorming page about IDLs and communication across boundaries]&lt;br /&gt;
&lt;br /&gt;
=Properties=&lt;br /&gt;
&lt;br /&gt;
The component model aims to satisfy several key properties. These properties were extracted from the [[Component_Model_Use_Cases | use cases]]. This section explains component model basics by studying each property.&lt;br /&gt;
&lt;br /&gt;
==Extensibility==&lt;br /&gt;
&lt;br /&gt;
The component model enables creation of new types of DOM elements by allowing the use of existing DOM elements in JavaScript prototype chain. For example, here&#039;s how you would create a new sub-type of HTMLElement:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
LayoutManagerPanel.prototype = Object.create(HTMLElement.prototype);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
// 1) Will not be able to add instances of LayoutManagerPanel to document without this call.&lt;br /&gt;
// 2) First parameter specifies the tagName of the element being registered and must be a string prefixed with &amp;quot;x-&amp;quot;.&lt;br /&gt;
Element.register(&amp;quot;x-layout-manager-panel&amp;quot;, LayoutManagerPanel);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
var panel = new LayoutManagerPanel();&lt;br /&gt;
document.body.appendChild(panel);&lt;br /&gt;
// or&lt;br /&gt;
document.body.innerHTML = &amp;quot;&amp;lt;x-layout-manager-panel&amp;gt;&amp;lt;/x-layout-manager-panel&amp;gt;&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt; instance is a Javascript object that is a valid DOM element, which can be added to the DOM tree. You can then extend this object using standard Javascript prototype inheritance.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
==Consistency==&lt;br /&gt;
&lt;br /&gt;
Because components are just DOM objects, they inherently share the same traversal and manipulation APIs, as defined by the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html DOM4]. The authors of components can extend these APIs by adding custom methods and properties on DOM objects, using standard JavaScript inheritance:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Widget.prototype = Object.create(HTMLElement.prototype, {&lt;br /&gt;
    update: {&lt;br /&gt;
        value: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
    value: {&lt;br /&gt;
        get: function() { /* ... */ },&lt;br /&gt;
        set: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
   // ...&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The common API surface and the ability to extend it serves as a natural API boundary for framework authors, enabling interoperability.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
&lt;br /&gt;
==Encapsulation==&lt;br /&gt;
Encapsulation refers to ability of the component to hide its implementation details and state from the document. To enable hiding of the implementation details, the component model provides a way to build a DOM tree that is not accessible from the document DOM tree, but is rendered as part of the document. This DOM tree, associated with the component is the [http://glazkov.com/2011/01/14/what-the-heck-is-shadow-dom/ shadow DOM]. The boundary between the document DOM tree and shadow DOM tree provides complete encapsulation, and ensures that:&lt;br /&gt;
* no shadow DOM tree nodes cross this boundary during event dispatch;&lt;br /&gt;
* document DOM tree has no access to nodes in the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Additionally, the boundary serves as a convenient style application lever, giving the component a choice of letting (or not letting) document CSS affect the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Every DOM element instance may only have (or &#039;&#039;host&#039;&#039;) one shadow DOM tree. A shadow tree is instantiated by creating an instance of the &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; object, which takes a reference to the hosting element as a parameter. Attempting to create more than one instance for the same element throws an exception:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
    var shadow = new ShadowRoot(this);&lt;br /&gt;
    var shadow2 = new ShadowRoot(this); // throws an exception.&lt;br /&gt;
   // ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
&lt;br /&gt;
==Composability==&lt;br /&gt;
&lt;br /&gt;
Being DOM objects, components fit naturally into the document DOM tree and support all of its composition properties. In addition, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element allows controlling interaction between shadow and document DOM trees. A &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element specifies places where immediate document tree children of the component are rendered &#039;&#039;inside&#039;&#039; the shadow tree.&lt;br /&gt;
&lt;br /&gt;
There can be more than one &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element in the shadow tree. The &amp;lt;code&amp;gt;includes&amp;lt;/code&amp;gt; attribute provides a convenient way to sort element&#039;s children by CSS selector. For example, a &amp;lt;code&amp;gt;DockLayoutPanel&amp;lt;/code&amp;gt; component could be used like this in the document DOM tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Chauncey Gardiner.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Provided that its shadow DOM tree looks like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content includes=&amp;amp;quot;.west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The document DOM tree children on of &amp;lt;code&amp;gt;x-dock-layout-panel&amp;lt;/code&amp;gt; will be rendered as if composed from this tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Avid Gardener.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Desugaring==&lt;br /&gt;
The component model also explains pretty well how the native HTML elements are built and dispels some of the magic associated with the &amp;quot;DOM object vs. JavaScript object&amp;quot; juxtaposition.&lt;br /&gt;
&lt;br /&gt;
Allowing DOM elements to participate in the JavaScript inheritance chain makes DOM elements more approachable and easier to work with.&lt;br /&gt;
&lt;br /&gt;
Complex DOM elements that are rendered with more than one CSS box (and aren&#039;t specified in terms of CSS, like [http://dev.w3.org/csswg/css3-lists/ lists]) are just components that have shadow DOM. Coincidentally, this also explains why you can&#039;t add shadow DOM subtrees to &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;details&amp;lt;/code&amp;gt; elements -- their &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;s are claimed by &amp;lt;code&amp;gt;HTMLInputElement&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;HTMLDetailsElement&amp;lt;/code&amp;gt; constructors, respectively.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
Considering the way Web works, the component model must allow decoupling of the instantiation and the declaration of the components in order to provide reasonable performance characteristics. It&#039;s an unfortunate, but necessary requirement. In other words, we must be able to handle situations where a component instance is created before it is declared. Here&#039;s an simple example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// somewhere in view.js&lt;br /&gt;
...&lt;br /&gt;
document.body.innerHTML = &#039;&amp;lt;div class=&amp;quot;awesome&amp;quot;&amp;gt;&amp;lt;x-layout&amp;gt;&amp;lt;x-spring-panel&amp;gt;...&amp;lt;/x-spring-panel&amp;gt;&amp;lt;/x-layout&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
// somewhere in layout.js&lt;br /&gt;
Element.register(&#039;x-layout&#039;, Layout);&lt;br /&gt;
Element.register(&#039;x-spring-panel&#039;, SpringPanel);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this situation, there is no room for error: &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt; &#039;&#039;must&#039;&#039; wait for &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; to load before executing. You can&#039;t load &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; lazily or in any different order, since it defines the components that are used in &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt;. Given that asynchronous, deferred or lazy-loading of script are all common performance techniques in today&#039;s Web, we must do better than block or throw an exception in such cases.&lt;br /&gt;
&lt;br /&gt;
The component model offers this solution:&lt;br /&gt;
&lt;br /&gt;
When an unknown DOM element with an &amp;quot;x-&amp;quot;-prefixed &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt; is encountered, we put a placeholder &amp;lt;code&amp;gt;HTMLUnknownElement&amp;lt;/code&amp;gt; instance in its place. As soon as the element is defined, all placeholder instances are replaced ([http://www.w3.org/TR/DOM-Level-3-Core/core.html#Document3-renameNode Document.renameNode]) with the new, proper DOM element.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
== Confinement ==&lt;br /&gt;
Confinement refers to the document protecting its implementation details and state from the component and can be viewed as the inverse of [[#Encapsulation | encapsulation]].&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks=&lt;br /&gt;
&lt;br /&gt;
The component model is comprised of the following building blocks.&lt;br /&gt;
&lt;br /&gt;
==Shadow DOM==&lt;br /&gt;
&lt;br /&gt;
Any DOM element can host a shadow DOM subtree. The shadow DOM subtree originates at &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;, which is coupled the hosting element at the time of its construction. You don&#039;t need any other building blocks in order to take advantage of the shadow DOM:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var element = document.createElement(&amp;quot;div&amp;quot;);&lt;br /&gt;
var shadow = new ShadowRoot(element);&lt;br /&gt;
shadow.appendChild(document.createElement(&amp;quot;p&amp;quot;)).textContent = &amp;quot;weee!!&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; instance is a [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-node Node], and acts as the root of the element&#039;s shadow DOM subtree. The &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; itself is never rendered, nor has styles. In this regard, it&#039;s similar to the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-documentfragment DocumentFragment]. It has two properties:&lt;br /&gt;
* &amp;lt;code&amp;gt;applyAuthorSheets&amp;lt;/code&amp;gt;, which is either &#039;&#039;&#039;true&#039;&#039;&#039; (that is, apply author style sheets from the document), or &#039;&#039;&#039;false&#039;&#039;&#039; (don&#039;t);&lt;br /&gt;
* &amp;lt;code&amp;gt;shadowHost&amp;lt;/code&amp;gt;, which points to the hosting element.&lt;br /&gt;
&lt;br /&gt;
==Content Element==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element is used with [[#Shadow_DOM | Shadow DOM]] and provides a mechanism for distributing hosting element&#039;s children inside of its shadow subtree. To preserve the [[#Encapsulation | encapsulation]] property, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; elements act as insertion points and do not leak any information about hosting element&#039;s children to the shadow DOM subtree or vise versa.&lt;br /&gt;
&lt;br /&gt;
==Constructable DOM Types==&lt;br /&gt;
The inability to construct DOM element using &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt; (with some exceptions) or use them in the prototype inheritance chain had confounded many Web developers since the beginning of DOM. This building block intends to rectify at least the latter by allowing &amp;lt;code&amp;gt;HTMLElement.call&amp;lt;/code&amp;gt; invocation and thus enabling creation of JavaScript objects with DOM elements in the prototype chain.&lt;br /&gt;
&lt;br /&gt;
==Registering Elements==&lt;br /&gt;
Working in conjunction with  [[#Constructable_DOM_Types | Constructable DOM Types]], this building block makes the list of valid markup tag names extensible by exposing &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
partial interface Element {&lt;br /&gt;
    static void register(in String tagName, in Function constructor);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to envisage a milder (though less elegant) version of element registration by keeping DOM element construction magical (thus decoupling it from [[#Constructable_DOM_Types | Constructable DOM Types]]) and making &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; use a callback, rather than &amp;lt;code&amp;gt;constructor&amp;lt;/code&amp;gt; as parameter. The callback would be invoked with an already-constructed DOM object with the specified &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt;, leaving the work of setting up properties on this object to the callback.&lt;br /&gt;
&lt;br /&gt;
==Confinement Primitives==&lt;br /&gt;
&lt;br /&gt;
The API surface of the component model lends itself well to proper confinement. Here&#039;s an approach that could be used to provide it (very early brainstorming):&lt;br /&gt;
&lt;br /&gt;
* Confinement is not tied to the component model. Instead, it&#039;s a new twist on the method of loading scripts. A script could be loaded as usual or it could be &#039;&#039;confined&#039;&#039;, or loaded into its own context.&lt;br /&gt;
&lt;br /&gt;
* When confined, a script has its own global and document objects. These objects only reveal some safe limited subset of the actual document objects.  Think of it as a same-origin iframe with restrictions on document and window.&lt;br /&gt;
&lt;br /&gt;
* You can communicate with the main document using &amp;lt;code&amp;gt;window.postMessage&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* The confined document DOM tree is always empty. Attempting to insert into it throws exceptions.&lt;br /&gt;
&lt;br /&gt;
* ... except when you append to elements in shadow DOM. That&#039;s right, you can do &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;new ShadowRoot&amp;lt;/code&amp;gt; in the confined document.&lt;br /&gt;
&lt;br /&gt;
* Whenever you register an element, it registers &#039;&#039;in the main document&#039;&#039; as well. Creating an instance of a component from an confined document produces a functional DOM element shell that proxies to the actual element in the confined document.&lt;br /&gt;
&lt;br /&gt;
Proposed API: introduce a new &amp;lt;code&amp;gt;confined&amp;lt;/code&amp;gt; attribute to the &amp;lt;code&amp;gt;script&amp;lt;/code&amp;gt; element. Presence of this attribute triggers loading scripts in the confined context.&lt;br /&gt;
&lt;br /&gt;
Confinement of script execution could be useful outside of the component model and also could be related to [https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html Content Security Policy].&lt;br /&gt;
&lt;br /&gt;
* [[Component_Model_Isolation_Brainstorming | Isolation Brainstorm]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks Use Case Coverage=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of building blocks, tabulated against the [[Component_Model_Use_Cases | use cases]] and approximate percentage of satisfying them:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | Building Block&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Layout_Manager | Layout Manager]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Widget_Mix-and-Match | Mix-and-Match]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Rendering_Form_Controls_with_SVG | SVG Controls]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Contacts_Widget | Contacts Widget]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Like.2F.2B1_Button | Like/+1 Button]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Media_Controls_For_The_Video_Element | Media Controls for the Video Element]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Details.2FSummary_Elements | Details/Summary Element]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| 34%&lt;br /&gt;
| 100%&lt;br /&gt;
| 25%&lt;br /&gt;
| 100%&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Content_Element | Content Element]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Registering_Elements | Registering Elements]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Comparison With Existing Specs and Implementations=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a brief overview of existing similar specifications and implementations:&lt;br /&gt;
* [http://msdn.microsoft.com/en-us/library/ms531018(v=vs.85).aspx HTML Components] is a [http://windows.microsoft.com/en-US/internet-explorer/products/ie/home Microsoft Internet Explorer]-specific method of creating custom DOM elements. Also see [http://www.w3.org/TR/NOTE-HTMLComponents HTML Components Note] (implemented in IE5+).&lt;br /&gt;
* [http://www.w3.org/TR/2001/NOTE-xbl-20010223/ XBL], currently implemented in Mozilla.&lt;br /&gt;
* [http://dev.w3.org/2006/xbl2/ XBL2], the ancestral spec of the Component Model, and a revision of XBL.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a handy overview of how each of these specs satisfies the component model [[#Properties | properties]]:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | Spec/Implementation&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Extensibility | Extensibility]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Consistency | Consistency]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Encapsulation | Encapsulation]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Composability | Composability]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Desugaring | Desugaring]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Performance | Performance]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Confinement | Confinement]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | HTML Components&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Components are magic, inextensible objects.&lt;br /&gt;
| &#039;&#039;&#039;Almost&#039;&#039;&#039;. Implementation provides ways to add properties, methods, events to element API, and the components are &#039;&#039;almost&#039;&#039; DOM elements. However, custom tags don&#039;t support all properties of a DOM element.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. There are some provisions for event encapsulation, nothing else.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. No provisions for handling document children vs. component-defined children.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The mechanism for extending bindings is entirely independent of DOM type or Javascript extensibility.&lt;br /&gt;
| &#039;&#039;&#039;Yes-ish&#039;&#039;&#039;. Bindings can override properties on the DOM element, although the mechanism is highly unnatural (XML declarations).&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;? Hard to say looking at TR note.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;. Some HTML elements in Gecko are implemented using it.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL2&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Same as XBL.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Bindings are discouraged from establishing an API surface on a bound element.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The spec didn&#039;t intend to describe how native elements are built.&lt;br /&gt;
| &#039;&#039;&#039;Somewhat&#039;&#039;&#039;. The lifecycle of a binding is well-defined and initialization stages are well-decoupled. However, there is no way to build a binding imperatively without loading a binding document.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The key differences between XBL2 and the Component Model are:&lt;br /&gt;
* The Component Model fully embraces the [[Behavior_Attachment#Behavior_Attachment_Methods | element behavior attachment]] by allowing creation of new types of DOM elements within a document. This is something Web Framework developers always wanted and repeatedly try to do with parallel object hierarchies. Eliminating ephemerality of the attachment simplifies and clarifies how things work conceptually -- there is no longer a place for &amp;quot;spooky action at a distance&amp;quot;, caused by a change of a random CSS selector or even removing an element from the tree.&lt;br /&gt;
* The Component Model is strongly biased toward reusing existing bits of the platform and well-established techniques instead of inventing new ones. For instance, instead of bindings inheritance, we rely on prototype inheritance. Instead of endeavoring to solve the incredibly complex, yet dubious problem of multiple bindings or shadow DOM trees, we simply suggest composition.&lt;br /&gt;
* The Component Model strives to add capabilities in layers (see [[#Building_Blocks | building blocks]]), each able to function on its own. The omnibus nature of XBL2 removes opportunities for layering, particularly as element identity, life cycle, and scripting are concerned. Perhaps this could be repaired somehow, but Component Model solves these issues without further complicating an already large, difficult to understand spec.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Decorators&amp;diff=7467</id>
		<title>Component Model Strawman: Decorators</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Decorators&amp;diff=7467"/>
		<updated>2011-10-26T20:08:31Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: re-stub decorators strawman page after moving discussion to brainstorming page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Stub&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Decorators&amp;diff=7466</id>
		<title>Component Model Strawman: Decorators</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Decorators&amp;diff=7466"/>
		<updated>2011-10-26T20:07:51Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: moved Component Model Strawman: Decorators to Component Model Decorator Brainstorming: Mostly brainstorming ATM, no concrete proposals yet&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Component Model Decorator Brainstorming]]&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7465</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7465"/>
		<updated>2011-10-26T20:07:51Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: moved Component Model Strawman: Decorators to Component Model Decorator Brainstorming: Mostly brainstorming ATM, no concrete proposals yet&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
=== Decorating Component Parts ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to have the ability to decorate specific parts of a component. E.g., the caps-lock indicator in an &amp;lt;tt&amp;gt;&amp;amp;lt;input&amp;amp;gt;&amp;lt;/tt&amp;gt; field could be considered a decorator.&lt;br /&gt;
&lt;br /&gt;
However, this clashes with the desire to not make the internals of components public. To reconcile this we&#039;d need a better model of how to declare component parts, whether &amp;quot;aspect-oriented components&amp;quot; or something different.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Binding Approaches =&lt;br /&gt;
&lt;br /&gt;
== CSS ==&lt;br /&gt;
&lt;br /&gt;
=== XBL Approach ===&lt;br /&gt;
&lt;br /&gt;
XBL uses a CSS attribute &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; to assign bindings to elements, as well as allowing elements to add bindings explicitly via &amp;lt;tt&amp;gt;element.addBinding()&amp;lt;/tt&amp;gt;. While XBL specifies implicit bindings, as would be used by decorators, the natural vehicle to apply decorators - CSS - only seems to allow one (?).&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Properties ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS &amp;lt;tt&amp;gt;decorator-&amp;amp;lt;xyz&amp;amp;gt;&amp;lt;/tt&amp;gt; property with the values &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;apply&amp;lt;/tt&amp;gt;. Rules can then switch individual decorators on or off.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* allows decorators to be switched on or off based on rules&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* requires probably controversial CSS extension&lt;br /&gt;
* does not define where decorator is rendered&lt;br /&gt;
* does not allow classification which decorators are applicable to which elements&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Pseudo-elements ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS pseudo-element or - probably better - an ID that can be accessed via a pseudo-element function &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* potentially easier to get acceptance for &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt; than for decorator properties.&lt;br /&gt;
* pseudo-element kinda makes sense, since the decorator can be considered becoming part of the decorated element&lt;br /&gt;
* allows further styling of the decorator&lt;br /&gt;
* classification what decorators can be applied to which elements in the realm of the possible (make &#039;illegal&#039; decorators fail in the CSS selector matching).&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* what are the properties for the pseudo-element?&lt;br /&gt;
* how to turn off a set pseudo-element again?&lt;br /&gt;
&lt;br /&gt;
= Implementation Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7463</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7463"/>
		<updated>2011-10-26T20:06:33Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Advantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
=== Decorating Component Parts ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to have the ability to decorate specific parts of a component. E.g., the caps-lock indicator in an &amp;lt;tt&amp;gt;&amp;amp;lt;input&amp;amp;gt;&amp;lt;/tt&amp;gt; field could be considered a decorator.&lt;br /&gt;
&lt;br /&gt;
However, this clashes with the desire to not make the internals of components public. To reconcile this we&#039;d need a better model of how to declare component parts, whether &amp;quot;aspect-oriented components&amp;quot; or something different.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Binding Approaches =&lt;br /&gt;
&lt;br /&gt;
== CSS ==&lt;br /&gt;
&lt;br /&gt;
=== XBL Approach ===&lt;br /&gt;
&lt;br /&gt;
XBL uses a CSS attribute &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; to assign bindings to elements, as well as allowing elements to add bindings explicitly via &amp;lt;tt&amp;gt;element.addBinding()&amp;lt;/tt&amp;gt;. While XBL specifies implicit bindings, as would be used by decorators, the natural vehicle to apply decorators - CSS - only seems to allow one (?).&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Properties ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS &amp;lt;tt&amp;gt;decorator-&amp;amp;lt;xyz&amp;amp;gt;&amp;lt;/tt&amp;gt; property with the values &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;apply&amp;lt;/tt&amp;gt;. Rules can then switch individual decorators on or off.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* allows decorators to be switched on or off based on rules&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* requires probably controversial CSS extension&lt;br /&gt;
* does not define where decorator is rendered&lt;br /&gt;
* does not allow classification which decorators are applicable to which elements&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Pseudo-elements ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS pseudo-element or - probably better - an ID that can be accessed via a pseudo-element function &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* potentially easier to get acceptance for &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt; than for decorator properties.&lt;br /&gt;
* pseudo-element kinda makes sense, since the decorator can be considered becoming part of the decorated element&lt;br /&gt;
* allows further styling of the decorator&lt;br /&gt;
* classification what decorators can be applied to which elements in the realm of the possible (make &#039;illegal&#039; decorators fail in the CSS selector matching).&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* what are the properties for the pseudo-element?&lt;br /&gt;
* how to turn off a set pseudo-element again?&lt;br /&gt;
&lt;br /&gt;
= Implementation Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7462</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7462"/>
		<updated>2011-10-26T20:04:51Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* CSS Decorator Properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
=== Decorating Component Parts ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to have the ability to decorate specific parts of a component. E.g., the caps-lock indicator in an &amp;lt;tt&amp;gt;&amp;amp;lt;input&amp;amp;gt;&amp;lt;/tt&amp;gt; field could be considered a decorator.&lt;br /&gt;
&lt;br /&gt;
However, this clashes with the desire to not make the internals of components public. To reconcile this we&#039;d need a better model of how to declare component parts, whether &amp;quot;aspect-oriented components&amp;quot; or something different.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Binding Approaches =&lt;br /&gt;
&lt;br /&gt;
== CSS ==&lt;br /&gt;
&lt;br /&gt;
=== XBL Approach ===&lt;br /&gt;
&lt;br /&gt;
XBL uses a CSS attribute &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; to assign bindings to elements, as well as allowing elements to add bindings explicitly via &amp;lt;tt&amp;gt;element.addBinding()&amp;lt;/tt&amp;gt;. While XBL specifies implicit bindings, as would be used by decorators, the natural vehicle to apply decorators - CSS - only seems to allow one (?).&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Properties ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS &amp;lt;tt&amp;gt;decorator-&amp;amp;lt;xyz&amp;amp;gt;&amp;lt;/tt&amp;gt; property with the values &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;apply&amp;lt;/tt&amp;gt;. Rules can then switch individual decorators on or off.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* allows decorators to be switched on or off based on rules&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* requires probably controversial CSS extension&lt;br /&gt;
* does not define where decorator is rendered&lt;br /&gt;
* does not allow classification which decorators are applicable to which elements&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Pseudo-elements ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS pseudo-element or - probably better - an ID that can be accessed via a pseudo-element function &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* potentially easier to get acceptance for &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt; than for decorator properties.&lt;br /&gt;
* pseudo-element kinda makes sense, since the decorator can be considered becoming part of the decorated element&lt;br /&gt;
* allows further styling of the decorator&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* what are the properties for the pseudo-element?&lt;br /&gt;
* how to turn off a set pseudo-element again?&lt;br /&gt;
&lt;br /&gt;
= Implementation Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7461</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7461"/>
		<updated>2011-10-26T20:04:00Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* CSS Decorator Properties */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
=== Decorating Component Parts ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to have the ability to decorate specific parts of a component. E.g., the caps-lock indicator in an &amp;lt;tt&amp;gt;&amp;amp;lt;input&amp;amp;gt;&amp;lt;/tt&amp;gt; field could be considered a decorator.&lt;br /&gt;
&lt;br /&gt;
However, this clashes with the desire to not make the internals of components public. To reconcile this we&#039;d need a better model of how to declare component parts, whether &amp;quot;aspect-oriented components&amp;quot; or something different.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Binding Approaches =&lt;br /&gt;
&lt;br /&gt;
== CSS ==&lt;br /&gt;
&lt;br /&gt;
=== XBL Approach ===&lt;br /&gt;
&lt;br /&gt;
XBL uses a CSS attribute &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; to assign bindings to elements, as well as allowing elements to add bindings explicitly via &amp;lt;tt&amp;gt;element.addBinding()&amp;lt;/tt&amp;gt;. While XBL specifies implicit bindings, as would be used by decorators, the natural vehicle to apply decorators - CSS - only seems to allow one (?).&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Properties ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS &amp;lt;tt&amp;gt;decorator-&amp;amp;lt;xyz&amp;amp;gt;&amp;lt;/tt&amp;gt; property with the values &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;apply&amp;lt;/tt&amp;gt;. Rules can then switch individual properties on or off.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* allows decorators to be switched on or off based on rules&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* requires probably controversial CSS extension&lt;br /&gt;
* does not define where decorator is rendered&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Pseudo-elements ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS pseudo-element or - probably better - an ID that can be accessed via a pseudo-element function &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* potentially easier to get acceptance for &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt; than for decorator properties.&lt;br /&gt;
* pseudo-element kinda makes sense, since the decorator can be considered becoming part of the decorated element&lt;br /&gt;
* allows further styling of the decorator&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* what are the properties for the pseudo-element?&lt;br /&gt;
* how to turn off a set pseudo-element again?&lt;br /&gt;
&lt;br /&gt;
= Implementation Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7459</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7459"/>
		<updated>2011-10-26T20:02:29Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: Binding approaches&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
=== Decorating Component Parts ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to have the ability to decorate specific parts of a component. E.g., the caps-lock indicator in an &amp;lt;tt&amp;gt;&amp;amp;lt;input&amp;amp;gt;&amp;lt;/tt&amp;gt; field could be considered a decorator.&lt;br /&gt;
&lt;br /&gt;
However, this clashes with the desire to not make the internals of components public. To reconcile this we&#039;d need a better model of how to declare component parts, whether &amp;quot;aspect-oriented components&amp;quot; or something different.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Binding Approaches =&lt;br /&gt;
&lt;br /&gt;
== CSS ==&lt;br /&gt;
&lt;br /&gt;
=== XBL Approach ===&lt;br /&gt;
&lt;br /&gt;
XBL uses a CSS attribute &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; to assign bindings to elements, as well as allowing elements to add bindings explicitly via &amp;lt;tt&amp;gt;element.addBinding()&amp;lt;/tt&amp;gt;. While XBL specifies implicit bindings, as would be used by decorators, the natural vehicle to apply decorators - CSS - only seems to allow one (?).&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Properties ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS &amp;lt;tt&amp;gt;decorator-&amp;lt;/tt&amp;gt; property with the values &amp;lt;tt&amp;gt;none&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;apply&amp;lt;/tt&amp;gt;. Rules can then switch individual properties on or off.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* allows decorators to be switched on or off based on rules&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* requires probably controversial CSS extension&lt;br /&gt;
* does not define where decorator is rendered&lt;br /&gt;
&lt;br /&gt;
=== CSS Decorator Pseudo-elements ===&lt;br /&gt;
&lt;br /&gt;
Allow decorators to specify a CSS pseudo-element or - probably better - an ID that can be accessed via a pseudo-element function &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Advantages ====&lt;br /&gt;
&lt;br /&gt;
* potentially easier to get acceptance for &amp;lt;tt&amp;gt;::decorator()&amp;lt;/tt&amp;gt; than for decorator properties.&lt;br /&gt;
* pseudo-element kinda makes sense, since the decorator can be considered becoming part of the decorated element&lt;br /&gt;
* allows further styling of the decorator&lt;br /&gt;
&lt;br /&gt;
==== Disadvantages ====&lt;br /&gt;
&lt;br /&gt;
* what are the properties for the pseudo-element?&lt;br /&gt;
* how to turn off a set pseudo-element again?&lt;br /&gt;
&lt;br /&gt;
= Implementation Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7452</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7452"/>
		<updated>2011-10-26T19:45:17Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Considerations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
=== Decorating Component Parts ===&lt;br /&gt;
&lt;br /&gt;
In some cases it may be desirable to have the ability to decorate specific parts of a component. E.g., the caps-lock indicator in an &amp;lt;tt&amp;gt;&amp;amp;lt;input&amp;amp;gt;&amp;lt;/tt&amp;gt; field could be considered a decorator.&lt;br /&gt;
&lt;br /&gt;
However, this clashes with the desire to not make the internals of components public. To reconcile this we&#039;d need a better model of how to declare component parts, whether &amp;quot;aspect-oriented components&amp;quot; or something different.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7448</id>
		<title>Component Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7448"/>
		<updated>2011-10-26T19:41:32Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Introduction */ Move strawman pages to top of introduction&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here&#039;s a good starting point for learning about the [https://github.com/dglazkov/component-model component model spec], which is being developed by applying a [[Component_Model_Methodology | defined methodology]].&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Component Model&#039;&#039;&#039; introduces comprehensive support for creating DOM elements. [[Component_Model_Use_Cases | Examples]] include layout managers, combinations of Dojo and jQuery widgets, isolated widgets, such as Like/+1 buttons, and built-in HTML elements themselves.  Reflecting on the experience of Mozilla&#039;s XBL  and Microsoft Internet Explorer&#039;s HTML components, the Component Model formalizes the concept of loosely coupled, coherent units of [[Behavior Attachment | behavior]]  in the [http://www.w3.org/wiki/Open_Web_Platform Web platform]. The functionality goals of the Component Model resemble  the goals of [http://dev.w3.org/2006/xbl2/ XBL2]; unlike XBL2, the Component Model seeks to be more incremental and modular while leveraging and integrating with new technologies.&lt;br /&gt;
&lt;br /&gt;
Strawman pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Decorators Decorators]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Element_Registration Element Registration]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Declarative_Syntax Declarative Syntax]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Styling Styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Isolation Isolation]&lt;br /&gt;
&lt;br /&gt;
Related links:&lt;br /&gt;
&lt;br /&gt;
* [[Behavior_Attachment | Behavior Attachment]] -- a general overview of the behavior attachment problem&lt;br /&gt;
* [[Component_Model_Methodology | Component Model Methodology]]&lt;br /&gt;
* [[Component_Model_Use_Cases | Component Model Use Cases]]&lt;br /&gt;
* [[Component_Model_Declarative_Syntax | Component Model Declarative Syntax]]&lt;br /&gt;
* [https://github.com/dglazkov/component-model Component Model Spec on Github]&lt;br /&gt;
* [http://dglazkov.github.com/component-model/ Component Model Spec Snapshot on Github Pages]&lt;br /&gt;
* [[Component_Model_Progressive_Enhancement | Component Model Progressive Enhancement]]&lt;br /&gt;
* [[Custom_Tags_Analysis | Custom Tags Analysis]]&lt;br /&gt;
&lt;br /&gt;
Discussion pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion Main discussion page with open questions]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion:_Rendering Rendering-specific discussion]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_CSS_Brainstorming brainstorming page about CSS and styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Isolation_Brainstorming brainstorming page about isolation and confinement]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_IDL_Brainstorming brainstorming page about IDLs and communication across boundaries]&lt;br /&gt;
&lt;br /&gt;
=Properties=&lt;br /&gt;
&lt;br /&gt;
The component model aims to satisfy several key properties. These properties were extracted from the [[Component_Model_Use_Cases | use cases]]. This section explains component model basics by studying each property.&lt;br /&gt;
&lt;br /&gt;
==Extensibility==&lt;br /&gt;
&lt;br /&gt;
The component model enables creation of new types of DOM elements by allowing the use of existing DOM elements in JavaScript prototype chain. For example, here&#039;s how you would create a new sub-type of HTMLElement:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
LayoutManagerPanel.prototype = Object.create(HTMLElement.prototype);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
// 1) Will not be able to add instances of LayoutManagerPanel to document without this call.&lt;br /&gt;
// 2) First parameter specifies the tagName of the element being registered and must be a string prefixed with &amp;quot;x-&amp;quot;.&lt;br /&gt;
Element.register(&amp;quot;x-layout-manager-panel&amp;quot;, LayoutManagerPanel);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
var panel = new LayoutManagerPanel();&lt;br /&gt;
document.body.appendChild(panel);&lt;br /&gt;
// or&lt;br /&gt;
document.body.innerHTML = &amp;quot;&amp;lt;x-layout-manager-panel&amp;gt;&amp;lt;/x-layout-manager-panel&amp;gt;&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt; instance is a Javascript object that is a valid DOM element, which can be added to the DOM tree. You can then extend this object using standard Javascript prototype inheritance.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
==Consistency==&lt;br /&gt;
&lt;br /&gt;
Because components are just DOM objects, they inherently share the same traversal and manipulation APIs, as defined by the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html DOM4]. The authors of components can extend these APIs by adding custom methods and properties on DOM objects, using standard JavaScript inheritance:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Widget.prototype = Object.create(HTMLElement.prototype, {&lt;br /&gt;
    update: {&lt;br /&gt;
        value: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
    value: {&lt;br /&gt;
        get: function() { /* ... */ },&lt;br /&gt;
        set: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
   // ...&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The common API surface and the ability to extend it serves as a natural API boundary for framework authors, enabling interoperability.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
&lt;br /&gt;
==Encapsulation==&lt;br /&gt;
Encapsulation refers to ability of the component to hide its implementation details and state from the document. To enable hiding of the implementation details, the component model provides a way to build a DOM tree that is not accessible from the document DOM tree, but is rendered as part of the document. This DOM tree, associated with the component is the [http://glazkov.com/2011/01/14/what-the-heck-is-shadow-dom/ shadow DOM]. The boundary between the document DOM tree and shadow DOM tree provides complete encapsulation, and ensures that:&lt;br /&gt;
* no shadow DOM tree nodes cross this boundary during event dispatch;&lt;br /&gt;
* document DOM tree has no access to nodes in the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Additionally, the boundary serves as a convenient style application lever, giving the component a choice of letting (or not letting) document CSS affect the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Every DOM element instance may only have (or &#039;&#039;host&#039;&#039;) one shadow DOM tree. A shadow tree is instantiated by creating an instance of the &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; object, which takes a reference to the hosting element as a parameter. Attempting to create more than one instance for the same element throws an exception:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
    var shadow = new ShadowRoot(this);&lt;br /&gt;
    var shadow2 = new ShadowRoot(this); // throws an exception.&lt;br /&gt;
   // ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
&lt;br /&gt;
==Composability==&lt;br /&gt;
&lt;br /&gt;
Being DOM objects, components fit naturally into the document DOM tree and support all of its composition properties. In addition, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element allows controlling interaction between shadow and document DOM trees. A &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element specifies places where immediate document tree children of the component are rendered &#039;&#039;inside&#039;&#039; the shadow tree.&lt;br /&gt;
&lt;br /&gt;
There can be more than one &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element in the shadow tree. The &amp;lt;code&amp;gt;includes&amp;lt;/code&amp;gt; attribute provides a convenient way to sort element&#039;s children by CSS selector. For example, a &amp;lt;code&amp;gt;DockLayoutPanel&amp;lt;/code&amp;gt; component could be used like this in the document DOM tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Chauncey Gardiner.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Provided that its shadow DOM tree looks like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content includes=&amp;amp;quot;.west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The document DOM tree children on of &amp;lt;code&amp;gt;x-dock-layout-panel&amp;lt;/code&amp;gt; will be rendered as if composed from this tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Avid Gardener.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Desugaring==&lt;br /&gt;
The component model also explains pretty well how the native HTML elements are built and dispels some of the magic associated with the &amp;quot;DOM object vs. JavaScript object&amp;quot; juxtaposition.&lt;br /&gt;
&lt;br /&gt;
Allowing DOM elements to participate in the JavaScript inheritance chain makes DOM elements more approachable and easier to work with.&lt;br /&gt;
&lt;br /&gt;
Complex DOM elements that are rendered with more than one CSS box (and aren&#039;t specified in terms of CSS, like [http://dev.w3.org/csswg/css3-lists/ lists]) are just components that have shadow DOM. Coincidentally, this also explains why you can&#039;t add shadow DOM subtrees to &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;details&amp;lt;/code&amp;gt; elements -- their &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;s are claimed by &amp;lt;code&amp;gt;HTMLInputElement&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;HTMLDetailsElement&amp;lt;/code&amp;gt; constructors, respectively.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
Considering the way Web works, the component model must allow decoupling of the instantiation and the declaration of the components in order to provide reasonable performance characteristics. It&#039;s an unfortunate, but necessary requirement. In other words, we must be able to handle situations where a component instance is created before it is declared. Here&#039;s an simple example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// somewhere in view.js&lt;br /&gt;
...&lt;br /&gt;
document.body.innerHTML = &#039;&amp;lt;div class=&amp;quot;awesome&amp;quot;&amp;gt;&amp;lt;x-layout&amp;gt;&amp;lt;x-spring-panel&amp;gt;...&amp;lt;/x-spring-panel&amp;gt;&amp;lt;/x-layout&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
// somewhere in layout.js&lt;br /&gt;
Element.register(&#039;x-layout&#039;, Layout);&lt;br /&gt;
Element.register(&#039;x-spring-panel&#039;, SpringPanel);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this situation, there is no room for error: &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt; &#039;&#039;must&#039;&#039; wait for &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; to load before executing. You can&#039;t load &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; lazily or in any different order, since it defines the components that are used in &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt;. Given that asynchronous, deferred or lazy-loading of script are all common performance techniques in today&#039;s Web, we must do better than block or throw an exception in such cases.&lt;br /&gt;
&lt;br /&gt;
The component model offers this solution:&lt;br /&gt;
&lt;br /&gt;
When an unknown DOM element with an &amp;quot;x-&amp;quot;-prefixed &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt; is encountered, we put a placeholder &amp;lt;code&amp;gt;HTMLUnknownElement&amp;lt;/code&amp;gt; instance in its place. As soon as the element is defined, all placeholder instances are replaced ([http://www.w3.org/TR/DOM-Level-3-Core/core.html#Document3-renameNode Document.renameNode]) with the new, proper DOM element.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
== Confinement ==&lt;br /&gt;
Confinement refers to the document protecting its implementation details and state from the component and can be viewed as the inverse of [[#Encapsulation | encapsulation]].&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks=&lt;br /&gt;
&lt;br /&gt;
The component model is comprised of the following building blocks.&lt;br /&gt;
&lt;br /&gt;
==Shadow DOM==&lt;br /&gt;
&lt;br /&gt;
Any DOM element can host a shadow DOM subtree. The shadow DOM subtree originates at &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;, which is coupled the hosting element at the time of its construction. You don&#039;t need any other building blocks in order to take advantage of the shadow DOM:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var element = document.createElement(&amp;quot;div&amp;quot;);&lt;br /&gt;
var shadow = new ShadowRoot(element);&lt;br /&gt;
shadow.appendChild(document.createElement(&amp;quot;p&amp;quot;)).textContent = &amp;quot;weee!!&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; instance is a [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-node Node], and acts as the root of the element&#039;s shadow DOM subtree. The &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; itself is never rendered, nor has styles. In this regard, it&#039;s similar to the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-documentfragment DocumentFragment]. It has two properties:&lt;br /&gt;
* &amp;lt;code&amp;gt;applyAuthorSheets&amp;lt;/code&amp;gt;, which is either &#039;&#039;&#039;true&#039;&#039;&#039; (that is, apply author style sheets from the document), or &#039;&#039;&#039;false&#039;&#039;&#039; (don&#039;t);&lt;br /&gt;
* &amp;lt;code&amp;gt;shadowHost&amp;lt;/code&amp;gt;, which points to the hosting element.&lt;br /&gt;
&lt;br /&gt;
==Content Element==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element is used with [[#Shadow_DOM | Shadow DOM]] and provides a mechanism for distributing hosting element&#039;s children inside of its shadow subtree. To preserve the [[#Encapsulation | encapsulation]] property, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; elements act as insertion points and do not leak any information about hosting element&#039;s children to the shadow DOM subtree or vise versa.&lt;br /&gt;
&lt;br /&gt;
==Constructable DOM Types==&lt;br /&gt;
The inability to construct DOM element using &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt; (with some exceptions) or use them in the prototype inheritance chain had confounded many Web developers since the beginning of DOM. This building block intends to rectify at least the latter by allowing &amp;lt;code&amp;gt;HTMLElement.call&amp;lt;/code&amp;gt; invocation and thus enabling creation of JavaScript objects with DOM elements in the prototype chain.&lt;br /&gt;
&lt;br /&gt;
==Registering Elements==&lt;br /&gt;
Working in conjunction with  [[#Constructable_DOM_Types | Constructable DOM Types]], this building block makes the list of valid markup tag names extensible by exposing &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
partial interface Element {&lt;br /&gt;
    static void register(in String tagName, in Function constructor);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to envisage a milder (though less elegant) version of element registration by keeping DOM element construction magical (thus decoupling it from [[#Constructable_DOM_Types | Constructable DOM Types]]) and making &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; use a callback, rather than &amp;lt;code&amp;gt;constructor&amp;lt;/code&amp;gt; as parameter. The callback would be invoked with an already-constructed DOM object with the specified &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt;, leaving the work of setting up properties on this object to the callback.&lt;br /&gt;
&lt;br /&gt;
==Confinement Primitives==&lt;br /&gt;
&lt;br /&gt;
The API surface of the component model lends itself well to proper confinement. Here&#039;s an approach that could be used to provide it (very early brainstorming):&lt;br /&gt;
&lt;br /&gt;
* Confinement is not tied to the component model. Instead, it&#039;s a new twist on the method of loading scripts. A script could be loaded as usual or it could be &#039;&#039;confined&#039;&#039;, or loaded into its own context.&lt;br /&gt;
&lt;br /&gt;
* When confined, a script has its own global and document objects. These objects only reveal some safe limited subset of the actual document objects.  Think of it as a same-origin iframe with restrictions on document and window.&lt;br /&gt;
&lt;br /&gt;
* You can communicate with the main document using &amp;lt;code&amp;gt;window.postMessage&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* The confined document DOM tree is always empty. Attempting to insert into it throws exceptions.&lt;br /&gt;
&lt;br /&gt;
* ... except when you append to elements in shadow DOM. That&#039;s right, you can do &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;new ShadowRoot&amp;lt;/code&amp;gt; in the confined document.&lt;br /&gt;
&lt;br /&gt;
* Whenever you register an element, it registers &#039;&#039;in the main document&#039;&#039; as well. Creating an instance of a component from an confined document produces a functional DOM element shell that proxies to the actual element in the confined document.&lt;br /&gt;
&lt;br /&gt;
Proposed API: introduce a new &amp;lt;code&amp;gt;confined&amp;lt;/code&amp;gt; attribute to the &amp;lt;code&amp;gt;script&amp;lt;/code&amp;gt; element. Presence of this attribute triggers loading scripts in the confined context.&lt;br /&gt;
&lt;br /&gt;
Confinement of script execution could be useful outside of the component model and also could be related to [https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html Content Security Policy].&lt;br /&gt;
&lt;br /&gt;
* [[Component_Model_Isolation_Brainstorming | Isolation Brainstorm]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks Use Case Coverage=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of building blocks, tabulated against the [[Component_Model_Use_Cases | use cases]] and approximate percentage of satisfying them:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | Building Block&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Layout_Manager | Layout Manager]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Widget_Mix-and-Match | Mix-and-Match]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Rendering_Form_Controls_with_SVG | SVG Controls]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Contacts_Widget | Contacts Widget]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Like.2F.2B1_Button | Like/+1 Button]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Media_Controls_For_The_Video_Element | Media Controls for the Video Element]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Details.2FSummary_Elements | Details/Summary Element]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| 34%&lt;br /&gt;
| 100%&lt;br /&gt;
| 25%&lt;br /&gt;
| 100%&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Content_Element | Content Element]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Registering_Elements | Registering Elements]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Comparison With Existing Specs and Implementations=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a brief overview of existing similar specifications and implementations:&lt;br /&gt;
* [http://msdn.microsoft.com/en-us/library/ms531018(v=vs.85).aspx HTML Components] is a [http://windows.microsoft.com/en-US/internet-explorer/products/ie/home Microsoft Internet Explorer]-specific method of creating custom DOM elements. Also see [http://www.w3.org/TR/NOTE-HTMLComponents HTML Components Note] (implemented in IE5+).&lt;br /&gt;
* [http://www.w3.org/TR/2001/NOTE-xbl-20010223/ XBL], currently implemented in Mozilla.&lt;br /&gt;
* [http://dev.w3.org/2006/xbl2/ XBL2], the ancestral spec of the Component Model, and a revision of XBL.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a handy overview of how each of these specs satisfies the component model [[#Properties | properties]]:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | Spec/Implementation&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Extensibility | Extensibility]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Consistency | Consistency]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Encapsulation | Encapsulation]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Composability | Composability]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Desugaring | Desugaring]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Performance | Performance]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Confinement | Confinement]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | HTML Components&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Components are magic, inextensible objects.&lt;br /&gt;
| &#039;&#039;&#039;Almost&#039;&#039;&#039;. Implementation provides ways to add properties, methods, events to element API, and the components are &#039;&#039;almost&#039;&#039; DOM elements. However, custom tags don&#039;t support all properties of a DOM element.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. There are some provisions for event encapsulation, nothing else.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. No provisions for handling document children vs. component-defined children.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The mechanism for extending bindings is entirely independent of DOM type or Javascript extensibility.&lt;br /&gt;
| &#039;&#039;&#039;Yes-ish&#039;&#039;&#039;. Bindings can override properties on the DOM element, although the mechanism is highly unnatural (XML declarations).&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;? Hard to say looking at TR note.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;. Some HTML elements in Gecko are implemented using it.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL2&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Same as XBL.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Bindings are discouraged from establishing an API surface on a bound element.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The spec didn&#039;t intend to describe how native elements are built.&lt;br /&gt;
| &#039;&#039;&#039;Somewhat&#039;&#039;&#039;. The lifecycle of a binding is well-defined and initialization stages are well-decoupled. However, there is no way to build a binding imperatively without loading a binding document.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The key differences between XBL2 and the Component Model are:&lt;br /&gt;
* The Component Model fully embraces the [[Behavior_Attachment#Behavior_Attachment_Methods | element behavior attachment]] by allowing creation of new types of DOM elements within a document. This is something Web Framework developers always wanted and repeatedly try to do with parallel object hierarchies. Eliminating ephemerality of the attachment simplifies and clarifies how things work conceptually -- there is no longer a place for &amp;quot;spooky action at a distance&amp;quot;, caused by a change of a random CSS selector or even removing an element from the tree.&lt;br /&gt;
* The Component Model is strongly biased toward reusing existing bits of the platform and well-established techniques instead of inventing new ones. For instance, instead of bindings inheritance, we rely on prototype inheritance. Instead of endeavoring to solve the incredibly complex, yet dubious problem of multiple bindings or shadow DOM trees, we simply suggest composition.&lt;br /&gt;
* The Component Model strives to add capabilities in layers (see [[#Building_Blocks | building blocks]]), each able to function on its own. The omnibus nature of XBL2 removes opportunities for layering, particularly as element identity, life cycle, and scripting are concerned. Perhaps this could be repaired somehow, but Component Model solves these issues without further complicating an already large, difficult to understand spec.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_IDL_Brainstorming&amp;diff=7447</id>
		<title>Component Model IDL Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_IDL_Brainstorming&amp;diff=7447"/>
		<updated>2011-10-26T19:40:03Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[User:Rolandsteiner|RolandSteiner]] This may be obsoleted by the Proxy approach for isolation.&lt;br /&gt;
&lt;br /&gt;
= Overview =&lt;br /&gt;
&lt;br /&gt;
Components, along with other web constructs such as workers and &amp;lt;code&amp;gt;&amp;amp;lt;iframe&amp;amp;gt;&amp;lt;/code&amp;gt; elements, may benefit from having their interfaces declared explicitly.&lt;br /&gt;
This would be especially useful in the case of confined components, who cannot be trusted to run scripts to effect subclassing and forwarding function calls between the hosting element and the shadow DOM.&lt;br /&gt;
The following is therefore a proposal for a declarative way to define the interface, that the browser then can safely inspect and use as a basis to set up such forwarding automatically.&lt;br /&gt;
&lt;br /&gt;
= Perceived Advantages =&lt;br /&gt;
&lt;br /&gt;
All of the following may look very verbose, and could probably be implemented much quicker in pure JavaScript. However, this approach still conceivably has the following advantages:&lt;br /&gt;
&lt;br /&gt;
* Can be used where JavaScript cannot be run, e.g. due to confinement&lt;br /&gt;
** Browser can automatically use the definitions to set up and abstract away &amp;lt;code&amp;gt;postMessage()&amp;lt;/code&amp;gt; calls, etc., that are necessary to bridge the separation&lt;br /&gt;
** Browser can even use magic to handle the forwarding and does not have to rely on &amp;lt;code&amp;gt;postMessage()&amp;lt;/code&amp;gt; or other functions available in JavaScript&lt;br /&gt;
* Not component-specific, could be used for workers, &amp;lt;code&amp;gt;&amp;amp;lt;iframes&amp;amp;gt;&amp;lt;/code&amp;gt;, intents&lt;br /&gt;
* Same definitions can be used cross-language (not limited to JavaScript)&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_IDL_Brainstorming&amp;diff=7445</id>
		<title>Component Model IDL Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_IDL_Brainstorming&amp;diff=7445"/>
		<updated>2011-10-26T19:38:40Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: Remove examples (too complicated, perhaps obsoleted by Proxy approach)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
Components, along with other web constructs such as workers and &amp;lt;code&amp;gt;&amp;amp;lt;iframe&amp;amp;gt;&amp;lt;/code&amp;gt; elements, may benefit from having their interfaces declared explicitly.&lt;br /&gt;
This would be especially useful in the case of confined components, who cannot be trusted to run scripts to effect subclassing and forwarding function calls between the hosting element and the shadow DOM.&lt;br /&gt;
The following is therefore a proposal for a declarative way to define the interface, that the browser then can safely inspect and use as a basis to set up such forwarding automatically.&lt;br /&gt;
&lt;br /&gt;
= Perceived Advantages =&lt;br /&gt;
&lt;br /&gt;
All of the following may look very verbose, and could probably be implemented much quicker in pure JavaScript. However, this approach still conceivably has the following advantages:&lt;br /&gt;
&lt;br /&gt;
* Can be used where JavaScript cannot be run, e.g. due to confinement&lt;br /&gt;
** Browser can automatically use the definitions to set up and abstract away &amp;lt;code&amp;gt;postMessage()&amp;lt;/code&amp;gt; calls, etc., that are necessary to bridge the separation&lt;br /&gt;
** Browser can even use magic to handle the forwarding and does not have to rely on &amp;lt;code&amp;gt;postMessage()&amp;lt;/code&amp;gt; or other functions available in JavaScript&lt;br /&gt;
* Not component-specific, could be used for workers, &amp;lt;code&amp;gt;&amp;amp;lt;iframes&amp;amp;gt;&amp;lt;/code&amp;gt;, intents&lt;br /&gt;
* Same definitions can be used cross-language (not limited to JavaScript)&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7443</id>
		<title>Component Model Strawman: Isolation</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7443"/>
		<updated>2011-10-26T19:13:23Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The isolated components definition is a &amp;lt;tt&amp;gt;provide&amp;lt;/tt&amp;gt; attributed HTML file which is loaded in separate namespace.&lt;br /&gt;
It is basically a document loaded by an iframe. But it has different way for communicating with the host document.&lt;br /&gt;
&lt;br /&gt;
See also the &amp;quot;Isolation&amp;quot; section on [[Component_Model_Strawman:_Declarative_Syntax]].&lt;br /&gt;
&lt;br /&gt;
== Terms ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Confined&#039;&#039;&#039;: disallow a component from accessing the containing page. Useful when a page does not trust the component or its source.&lt;br /&gt;
* &#039;&#039;&#039;Encapsulated&#039;&#039;&#039;: disallow the containing page from accessing the internals of the component. Useful when a component wants to prevent a page from meddling with it.&lt;br /&gt;
* &#039;&#039;&#039;Isolated&#039;&#039;&#039;: a component that is both confined and encapsulated.&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
To facilitate component isolation:&lt;br /&gt;
&lt;br /&gt;
=== Autonomy ===&lt;br /&gt;
&lt;br /&gt;
Components should be autonomous entities that can be loaded and applied as a single building block. Avoid requiring extensive manipulations on both side of the page &amp;lt;=&amp;gt; component divide.&lt;br /&gt;
&lt;br /&gt;
This will also help in implementing decorators.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
The interface of a component should be minimal and well defined. Embedding pages should not be required (nor able to in the case of encapsulation) to access, or even know about, the internals of a component. Conversely, the function of a component should not depend on being able to access the DOM or any other information of the hosting page that is not provided through an interface.&lt;br /&gt;
&lt;br /&gt;
The component should be able to apply and filter data and styles passed in as it sees fit.&lt;br /&gt;
&lt;br /&gt;
= Approaches =&lt;br /&gt;
&lt;br /&gt;
== Element Registration ==&lt;br /&gt;
&lt;br /&gt;
* XXX: define the element name resolution order.&lt;br /&gt;
&lt;br /&gt;
Isolated providing document can register new elements for the host document. &lt;br /&gt;
But in slightly different way: the lifecycle callbacks including &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt; use &lt;br /&gt;
&amp;lt;tt&amp;gt;HTMLElementProxy&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;HTMLElement&amp;lt;/tt&amp;gt;, that means &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; should return&lt;br /&gt;
an instance of &amp;lt;tt&amp;gt;HTMLElementProxy&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt; callback receives it as a parameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
       HTMLElementElement.current.open = function() {&lt;br /&gt;
         var element = return new HTMLElementProxy();&lt;br /&gt;
         element.addEventListener(&amp;quot;message&amp;quot;, ...);&lt;br /&gt;
         return element;&lt;br /&gt;
       }});&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== HTMLElementProxy ==&lt;br /&gt;
&lt;br /&gt;
An element on the host document is represented as a &amp;lt;tt&amp;gt;HTMLElementProxy&amp;lt;/tt&amp;gt; object in the isolated document.&lt;br /&gt;
If an isolated-registered element is built on the host document, a set of lifecycle callback is invoked on the isolated document.&lt;br /&gt;
The &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; callback should return an &amp;lt;tt&amp;gt;HTMLElementProxy&amp;lt;/tt&amp;gt; object, which is then connected to &lt;br /&gt;
associated element on the host document.&lt;br /&gt;
Scripts in both document can communicate through the proxy using MessageEvent.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
interface [&lt;br /&gt;
  Constructor()&lt;br /&gt;
] HTMLElementProxy : EventTarget {&lt;br /&gt;
   void postMessage(any message, optional sequence&amp;lt;Transferable&amp;gt; transfer);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Should be implemented by HTMLElement family.&lt;br /&gt;
interface [&lt;br /&gt;
  Constructor(),&lt;br /&gt;
  NoInterfaceObject&lt;br /&gt;
] HTMLElementHost {&lt;br /&gt;
   void postMessage(any message, optional sequence&amp;lt;Transferable&amp;gt; transfer);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Isolated ShadowRoot ==&lt;br /&gt;
&lt;br /&gt;
Shadow Trees for the host document can live in the isolated document.&lt;br /&gt;
The &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; constructor can accept &amp;lt;tt&amp;gt;HTMLElementProxy&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;HTMLElement&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
       HTMLElementElement.current.open = function() {&lt;br /&gt;
         var element = return new HTMLElementProxy();&lt;br /&gt;
         var shadow = new ShadowRoot(element);&lt;br /&gt;
         // Build the shadow tree here...&lt;br /&gt;
         return element;&lt;br /&gt;
       }});&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Isolated &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; objects don&#039;t propagate events across two documents.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7442</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7442"/>
		<updated>2011-10-26T19:11:43Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Questions */ Styling Q&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Styling ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the styling of the decorated element?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7435</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7435"/>
		<updated>2011-10-26T17:46:50Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Questions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
=== Multiple Decorators ===&lt;br /&gt;
&lt;br /&gt;
It seems useful and straight-forward to allow multiple decorators on a single element. However, assigning decorators, e.g., via a CSS &amp;lt;tt&amp;gt;binding&amp;lt;/tt&amp;gt; property and using the CSS cascade would leave only the decorator stemming from the most specific rule.&lt;br /&gt;
&lt;br /&gt;
= Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7434</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7434"/>
		<updated>2011-10-26T17:38:55Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: Approaches, Questions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;br /&gt;
&lt;br /&gt;
== Questions ==&lt;br /&gt;
&lt;br /&gt;
=== Recursiveness ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator be decorated itself?&lt;br /&gt;
&lt;br /&gt;
=== Layout ===&lt;br /&gt;
&lt;br /&gt;
Can a decorator affect the layout of the decorated element and/or surrounding elements? For example, consider an element that is given a specific height and width:&lt;br /&gt;
&lt;br /&gt;
* If the purpose of the dimensions is to fit, e.g., an image, then changing those dimensions to fit the decorator seems ill-advised&lt;br /&gt;
* If the purpose of the dimensions is for precise layouting, then shifting surrounding elements to fit the decorator seems ill-advised&lt;br /&gt;
&lt;br /&gt;
(However, given that which decorators to consider is in the hands of the page author the above are only minor considerations.)&lt;br /&gt;
&lt;br /&gt;
= Approaches =&lt;br /&gt;
&lt;br /&gt;
== Pure CSS ==&lt;br /&gt;
&lt;br /&gt;
In this approach, the decorator is defined purely in CSS. To this end we&#039;d need to extend the layout capabilities of CSS to allow the creation and arrangement of arbitrary render boxes.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Does not create inter-dependence between DOM and CSS applying decorators - everything is handled by CSS.&lt;br /&gt;
* Trivially allows for the application of decorators via generic CSS rules.&lt;br /&gt;
* Extending the layout capabilities of CSS can be useful - and has been asked for - in general.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Expressiveness seems limited.&lt;br /&gt;
* Open questions regarding interactivity, how to bind event listeners, etc.&lt;br /&gt;
* Long standardization to get there.&lt;br /&gt;
&lt;br /&gt;
== Component-like Shadow DOM ==&lt;br /&gt;
&lt;br /&gt;
The decorators are declared similar to components and have their own DOM tree. A component is rendered in the specified position separately from the main DOM.&lt;br /&gt;
&lt;br /&gt;
=== Advantages ===&lt;br /&gt;
&lt;br /&gt;
* Greater expressiveness&lt;br /&gt;
* Uses tools we already have or develop for components.&lt;br /&gt;
&lt;br /&gt;
=== Disadvantages ===&lt;br /&gt;
&lt;br /&gt;
* Creates a inter-dependency between DOM and the triggers (e.g., CSS). Potential recursiveness.&lt;br /&gt;
* &amp;quot;Heavier&amp;quot; in application.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7432</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7432"/>
		<updated>2011-10-26T17:17:50Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Overview */ Triggers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Dynamic ===&lt;br /&gt;
&lt;br /&gt;
A decorator can be applied and removed dynamically, as opposed to a component, which is applied statically and cannot change. Furthermore, an element can have 0-n decorators, but just 0-1 components.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;br /&gt;
&lt;br /&gt;
== Triggers ==&lt;br /&gt;
&lt;br /&gt;
We consider the following triggers for the application of decorators:&lt;br /&gt;
&lt;br /&gt;
* element tag names&lt;br /&gt;
* attributes&lt;br /&gt;
* ARIA roles&lt;br /&gt;
* general CSS&lt;br /&gt;
&lt;br /&gt;
If we can achieve decorator-assignment via generic CSS rules, this can handle all cases above.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7430</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7430"/>
		<updated>2011-10-26T17:05:44Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: Considerations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
A decorator cannot add additional interfaces to the decorated element.&lt;br /&gt;
&lt;br /&gt;
=== Confinement ===&lt;br /&gt;
&lt;br /&gt;
A decorator may come from an untrusted source. In case the decorated element is a component, that component may come from an untrusted source as well, which may be different than the decorator&#039;s.&lt;br /&gt;
&lt;br /&gt;
Therefore, an approach that merges a decorator with a component&#039;s shadow tree, e.g., via &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; is undesirable. Similarly, collecting decorator&#039;s under a component&#039;s &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; does not work.&lt;br /&gt;
&lt;br /&gt;
=== Priority Inversion ===&lt;br /&gt;
&lt;br /&gt;
An XBL-style &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; places the decorator(s) on top of the main component, making the decorator the root of the tree. This inverts the priority that should exist between a decorator and the main component. Indeed, a decorator might omit the &amp;lt;tt&amp;gt;&amp;amp;lt;inherited&amp;amp;gt;&amp;lt;/tt&amp;gt; element, hiding the component (and other decorators) entirely.&lt;br /&gt;
&lt;br /&gt;
Decorators therefore should be rendered &amp;quot;around&amp;quot; the element or component. Cases where a tighter coupling is required are probably better handled by composition.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7389</id>
		<title>Component Model Strawman: Styling</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7389"/>
		<updated>2011-10-25T20:37:42Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
There are 4 actors that may modify the style of (parts of) a component:&lt;br /&gt;
&lt;br /&gt;
* the browser&lt;br /&gt;
* the component author&lt;br /&gt;
* the page author&lt;br /&gt;
* the user&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7384</id>
		<title>Component Model Strawman: Isolation</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7384"/>
		<updated>2011-10-25T19:56:31Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: Add considerations section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
== Terms ==&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Confined&#039;&#039;&#039;: disallow a component from accessing the containing page. Useful when a page does not trust the component or its source.&lt;br /&gt;
* &#039;&#039;&#039;Encapsulated&#039;&#039;&#039;: disallow the containing page from accessing the internals of the component. Useful when a component wants to prevent a page from meddling with it.&lt;br /&gt;
* &#039;&#039;&#039;Isolated&#039;&#039;&#039;: a component that is both confined and encapsulated.&lt;br /&gt;
&lt;br /&gt;
== Considerations ==&lt;br /&gt;
&lt;br /&gt;
To facilitate component isolation:&lt;br /&gt;
&lt;br /&gt;
=== Autonomy ===&lt;br /&gt;
&lt;br /&gt;
Components should be autonomous entities that can be loaded and applied as a single building block. Avoid requiring extensive manipulations on both side of the page &amp;lt;=&amp;gt; component divide.&lt;br /&gt;
&lt;br /&gt;
This will also help in implementing decorators.&lt;br /&gt;
&lt;br /&gt;
=== Interface ===&lt;br /&gt;
&lt;br /&gt;
The interface of a component should be minimal and well defined. Embedding pages should not be required (nor able to in the case of encapsulation) to access, or even know about, the internals of a component. Conversely, the function of a component should not depend on being able to access the DOM or any other information of the hosting page that is not provided through an interface.&lt;br /&gt;
&lt;br /&gt;
The component should be able to apply and filter data and styles passed in as it sees fit.&lt;br /&gt;
&lt;br /&gt;
= Element Registration and HTMLElementProxy =&lt;br /&gt;
&lt;br /&gt;
The isolated components definition is a &amp;lt;tt&amp;gt;provide&amp;lt;/tt&amp;gt; attributed HTML file which is loaded in separate namespace.&lt;br /&gt;
It is basically a document loaded by an iframe. But it has different way for communicating with the host document.&lt;br /&gt;
&lt;br /&gt;
See also the &amp;quot;Isolation&amp;quot; section on [[Component_Model_Strawman:_Declarative_Syntax]].&lt;br /&gt;
&lt;br /&gt;
* XXX: define the element name resolution order.&lt;br /&gt;
&lt;br /&gt;
Isolated providing document can register new elements for the host document. &lt;br /&gt;
But in slightly different way: the lifecycle callbacks including &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt; use &lt;br /&gt;
&amp;lt;tt&amp;gt;HTMLElementProxy&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;HTMLElement&amp;lt;/tt&amp;gt;, that means &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; should return&lt;br /&gt;
an instance of &amp;lt;tt&amp;gt;HTMLElementProxy&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt; callback receives it as a parameter.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
       HTMLElementElement.current.open = function() {&lt;br /&gt;
         var element = return new HTMLElementProxy();&lt;br /&gt;
         element.addEventListener(&amp;quot;message&amp;quot;, ...&lt;br /&gt;
         return element;&lt;br /&gt;
       }});&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Declarative_Syntax&amp;diff=7383</id>
		<title>Component Model Strawman: Declarative Syntax</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Declarative_Syntax&amp;diff=7383"/>
		<updated>2011-10-25T19:42:48Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Isolated definition */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Element Registration =&lt;br /&gt;
&lt;br /&gt;
Let’s start from the minimum form of the element registration.&lt;br /&gt;
Authors can use an &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element to registering new element name.&lt;br /&gt;
Now agent recognizes &amp;lt;tt&amp;gt;x-comment&amp;lt;/tt&amp;gt; as &amp;lt;tt&amp;gt;HTMLRegisteredElement&amp;lt;/tt&amp;gt;.&lt;br /&gt;
This is just a plain old HTML element which has its own name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scripting ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element also provides an opportunity to give a behavior for the instance of the registered element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;script&amp;gt;&lt;br /&gt;
  var e = document.head.querySelector(“[for=x-comment]”);&lt;br /&gt;
  e.close = function(element) {&lt;br /&gt;
    element.addEventListener(“click”, function(evt) {&lt;br /&gt;
      ..&lt;br /&gt;
    });&lt;br /&gt;
  };&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using  &amp;lt;tt&amp;gt;HTMLElementElement.register()&amp;lt;/tt&amp;gt;, authors can register a set of lifecycle callbacks for each registered element.&lt;br /&gt;
There are two types of lifecycle event: &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt;. The open is for creating the new instance of the &amp;lt;tt&amp;gt;Element&amp;lt;/tt&amp;gt;.&lt;br /&gt;
You can override the constructor of the element by providing &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; callback.&lt;br /&gt;
The &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt; callback provides the way to enhance created instance.&lt;br /&gt;
This is useful when you use given attributes to define the behavior.&lt;br /&gt;
&lt;br /&gt;
To make the definition self-contained, we can put a &amp;lt;tt&amp;gt;script&amp;lt;/tt&amp;gt; blocks inside an &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
       class Comment : HTMLElement {&lt;br /&gt;
           this.shadow = new ShawowRoot(this);&lt;br /&gt;
           ..;&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       HTMLElementElement.current.open = function() { return new Comment(); }});&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the script refers a static property called &amp;lt;tt&amp;gt;HTMLElementElement.current&amp;lt;/tt&amp;gt;,&lt;br /&gt;
which points the enclosing &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element.&lt;br /&gt;
This example also shows how we can provide an &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; lifecycle callback. &lt;br /&gt;
&lt;br /&gt;
== Styling ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element allows a &amp;lt;tt&amp;gt;style&amp;lt;/tt&amp;gt; element as a child,&lt;br /&gt;
which accept &amp;lt;tt&amp;gt;:current&amp;lt;/tt&amp;gt; pseudo-class to specify the registering element.&lt;br /&gt;
&lt;br /&gt;
Following example gives &amp;quot;color: gray&amp;quot; to the &amp;lt;tt&amp;gt;x-comment&amp;lt;/tt&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;style&amp;gt;&lt;br /&gt;
    :current {&lt;br /&gt;
       color: gray;&lt;br /&gt;
    }&lt;br /&gt;
    &amp;lt;/style&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[User:Rolandsteiner|RolandSteiner]] IMHO it&#039;s simpler to just create a &#039;x-comment&#039; style rule in some style sheet within the head. This way we don&#039;t need to add a :current pseudo-class. Also, there&#039;s no way we could limit the style rules within &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; to only affect that element anyway.&lt;br /&gt;
&lt;br /&gt;
= Shadow DOM Template =&lt;br /&gt;
&lt;br /&gt;
An initial shape of new shadow tree can be defined using a &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;template id=”comment-template”&amp;gt;&lt;br /&gt;
    &amp;lt;div&amp;gt;&amp;lt;content&amp;gt;&amp;lt;/content&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
  &amp;lt;/template&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; is instantiated through&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; constructor and&lt;br /&gt;
* &amp;lt;tt&amp;gt;shadow-template&amp;lt;/tt&amp;gt; CSS property.&lt;br /&gt;
&lt;br /&gt;
== The ShadowRoot constructor ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; constructor accepts a &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element to instantiate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ..&lt;br /&gt;
  this.shadow = new ShadowRoot(this, document.getElementById(“comment-template”));&lt;br /&gt;
  ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The shadow-template CSS property  (brainstorming) ==&lt;br /&gt;
&lt;br /&gt;
The template for shadow root also can be applied using CSS property.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.comment {&lt;br /&gt;
  shadow-template: url(&#039;#comment-template&#039;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that imperatively-applied shadows always supersede shadows from the styling.&lt;br /&gt;
Also, there is no way to access style-originated shadows from the scripting environment.&lt;br /&gt;
&lt;br /&gt;
== The Instantiation Event and Scripting ==&lt;br /&gt;
&lt;br /&gt;
Even though the &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; can be used to define an extra visual representation for an element,&lt;br /&gt;
It would be useful if author can attach a script for the template-generated shadow tree.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element generates an &amp;lt;tt&amp;gt;instantiation&amp;lt;/tt&amp;gt; event for &lt;br /&gt;
each template instantiation. Authors can listen it to setup event handlers for&lt;br /&gt;
generated elements by the template. The event doesn&#039;t bubble, and it isn&#039;t cancelable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;template id=”comment-template”&amp;gt;&lt;br /&gt;
    &amp;lt;div&amp;gt;&amp;lt;content&amp;gt;&amp;lt;/content&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
  &amp;lt;/template&amp;gt;&lt;br /&gt;
  &amp;lt;script&amp;gt;&lt;br /&gt;
  var e = document.getElementById(&amp;quot;comment-template&amp;quot;);&lt;br /&gt;
  e.addEventListener(&amp;quot;instantiation&amp;quot;, function(evt) {&lt;br /&gt;
    evt.root.querySelector(&amp;quot;div&amp;quot;).addEventListener(&amp;quot;click&amp;quot;, function(evt) { ... });&lt;br /&gt;
  });&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element also allows a &amp;lt;tt&amp;gt;script&amp;lt;/tt&amp;gt; element as a child,&lt;br /&gt;
whose script block can access &amp;lt;tt&amp;gt;HTMLTemplateElement.current&amp;lt;/tt&amp;gt; to refer the enclosing &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;template id=”comment-template”&amp;gt;&lt;br /&gt;
    &amp;lt;div&amp;gt;&amp;lt;content&amp;gt;&amp;lt;/content&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
    HTMLTemplateElement.current.addEventListener(&amp;quot;instantiation&amp;quot;, function(evt) {&lt;br /&gt;
      evt.root.querySelector(&amp;quot;div&amp;quot;).addEventListener(&amp;quot;click&amp;quot;, function(evt) { ... });&lt;br /&gt;
    });&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/template&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Isolation =&lt;br /&gt;
&lt;br /&gt;
== Standalone Form ==&lt;br /&gt;
&lt;br /&gt;
The element registration and template definition are also done in a separate HTML.&lt;br /&gt;
Each HTML file which provides the element registration should have a &amp;lt;tt&amp;gt;provide&amp;lt;/tt&amp;gt; attribute on the root html element.&lt;br /&gt;
This attribute prevents accidental loading of existing HTML files. &lt;br /&gt;
&lt;br /&gt;
Effective markup vocabulary for the providing HTML is limited.&lt;br /&gt;
Agents only recognize a head element as a child of the root element when the HTML document is loaded as required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html provide&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The host element can load the html with element definition using a &amp;lt;tt&amp;gt;link&amp;lt;/tt&amp;gt; element with its &amp;lt;tt&amp;gt;rel&amp;lt;/tt&amp;gt; attribute set to &amp;lt;tt&amp;gt;component&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standalone definition can be done by a script file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/javascript” href=&amp;quot;comment.js&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is equivalent to linking to a HTML file of like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html provide&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;script type=”text/javascript” src=&amp;quot;comment.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shared definition ==&lt;br /&gt;
&lt;br /&gt;
In the default, these definitions are coming into the host document.&lt;br /&gt;
That means a providing HTML doesn’t have its own document nor the global object. Agents use these of the host document. &lt;br /&gt;
&lt;br /&gt;
== Isolated definition ==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;tt&amp;gt;rel&amp;lt;/tt&amp;gt; attribute contains the term &amp;lt;tt&amp;gt;isolate&amp;lt;/tt&amp;gt;, the linked HTML is loaded as a separate document object.&lt;br /&gt;
The script inside the document is given a separate global object. &lt;br /&gt;
&lt;br /&gt;
For the host document, there is no way to access the loaded document directly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component; isolate” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[User:Rolandsteiner|RolandSteiner]] Should we make &amp;lt;tt&amp;gt;isolate&amp;lt;/tt&amp;gt; an attribute on &amp;lt;tt&amp;gt;link&amp;lt;/tt&amp;gt; rather than a &amp;lt;tt&amp;gt;rel&amp;lt;/tt&amp;gt; value? As Dimitri mentioned, this could be useful in general and would allow us to branch it off into a separate spec.&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Declarative_Syntax&amp;diff=7382</id>
		<title>Component Model Strawman: Declarative Syntax</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Declarative_Syntax&amp;diff=7382"/>
		<updated>2011-10-25T18:08:12Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Styling */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Element Registration =&lt;br /&gt;
&lt;br /&gt;
Let’s start from the minimum form of the element registration.&lt;br /&gt;
Authors can use an &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element to registering new element name.&lt;br /&gt;
Now agent recognizes &amp;lt;tt&amp;gt;x-comment&amp;lt;/tt&amp;gt; as &amp;lt;tt&amp;gt;HTMLRegisteredElement&amp;lt;/tt&amp;gt;.&lt;br /&gt;
This is just a plain old HTML element which has its own name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Scripting ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element also provides an opportunity to give a behavior for the instance of the registered element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;script&amp;gt;&lt;br /&gt;
  var e = document.head.querySelector(“[for=x-comment]”);&lt;br /&gt;
  e.close = function(element) {&lt;br /&gt;
    element.addEventListener(“click”, function(evt) {&lt;br /&gt;
      ..&lt;br /&gt;
    });&lt;br /&gt;
  };&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using  &amp;lt;tt&amp;gt;HTMLElementElement.register()&amp;lt;/tt&amp;gt;, authors can register a set of lifecycle callbacks for each registered element.&lt;br /&gt;
There are two types of lifecycle event: &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt;. The open is for creating the new instance of the &amp;lt;tt&amp;gt;Element&amp;lt;/tt&amp;gt;.&lt;br /&gt;
You can override the constructor of the element by providing &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; callback.&lt;br /&gt;
The &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt; callback provides the way to enhance created instance.&lt;br /&gt;
This is useful when you use given attributes to define the behavior.&lt;br /&gt;
&lt;br /&gt;
To make the definition self-contained, we can put a &amp;lt;tt&amp;gt;script&amp;lt;/tt&amp;gt; blocks inside an &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
       class Comment : HTMLElement {&lt;br /&gt;
           this.shadow = new ShawowRoot(this);&lt;br /&gt;
           ..;&lt;br /&gt;
       }&lt;br /&gt;
&lt;br /&gt;
       HTMLElementElement.current.open = function() { return new Comment(); }});&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the script refers a static property called &amp;lt;tt&amp;gt;HTMLElementElement.current&amp;lt;/tt&amp;gt;,&lt;br /&gt;
which points the enclosing &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element.&lt;br /&gt;
This example also shows how we can provide an &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; lifecycle callback. &lt;br /&gt;
&lt;br /&gt;
== Styling ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; element allows a &amp;lt;tt&amp;gt;style&amp;lt;/tt&amp;gt; element as a child,&lt;br /&gt;
which accept &amp;lt;tt&amp;gt;:current&amp;lt;/tt&amp;gt; pseudo-class to specify the registering element.&lt;br /&gt;
&lt;br /&gt;
Following example gives &amp;quot;color: gray&amp;quot; to the &amp;lt;tt&amp;gt;x-comment&amp;lt;/tt&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;&lt;br /&gt;
    &amp;lt;style&amp;gt;&lt;br /&gt;
    :current {&lt;br /&gt;
       color: gray;&lt;br /&gt;
    }&lt;br /&gt;
    &amp;lt;/style&amp;gt;&lt;br /&gt;
  &amp;lt;/element&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[User:Rolandsteiner|RolandSteiner]] IMHO it&#039;s simpler to just create a &#039;x-comment&#039; style rule in some style sheet within the head. This way we don&#039;t need to add a :current pseudo-class. Also, there&#039;s no way we could limit the style rules within &amp;lt;tt&amp;gt;element&amp;lt;/tt&amp;gt; to only affect that element anyway.&lt;br /&gt;
&lt;br /&gt;
= Shadow DOM Template =&lt;br /&gt;
&lt;br /&gt;
An initial shape of new shadow tree can be defined using a &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;template id=”comment-template”&amp;gt;&lt;br /&gt;
    &amp;lt;div&amp;gt;&amp;lt;content&amp;gt;&amp;lt;/content&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
  &amp;lt;/template&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; is instantiated through&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; constructor and&lt;br /&gt;
* &amp;lt;tt&amp;gt;shadow-template&amp;lt;/tt&amp;gt; CSS property.&lt;br /&gt;
&lt;br /&gt;
== The ShadowRoot constructor ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;ShadowRoot&amp;lt;/tt&amp;gt; constructor accepts a &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element to instantiate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  ..&lt;br /&gt;
  this.shadow = new ShadowRoot(this, document.getElementById(“comment-template”));&lt;br /&gt;
  ..&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The shadow-template CSS property  (brainstorming) ==&lt;br /&gt;
&lt;br /&gt;
The template for shadow root also can be applied using CSS property.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
.comment {&lt;br /&gt;
  shadow-template: url(&#039;#comment-template&#039;);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that imperatively-applied shadows always supersede shadows from the styling.&lt;br /&gt;
Also, there is no way to access style-originated shadows from the scripting environment.&lt;br /&gt;
&lt;br /&gt;
== The Instantiation Event and Scripting ==&lt;br /&gt;
&lt;br /&gt;
Even though the &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; can be used to define an extra visual representation for an element,&lt;br /&gt;
It would be useful if author can attach a script for the template-generated shadow tree.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element generates an &amp;lt;tt&amp;gt;instantiation&amp;lt;/tt&amp;gt; event for &lt;br /&gt;
each template instantiation. Authors can listen it to setup event handlers for&lt;br /&gt;
generated elements by the template. The event doesn&#039;t bubble, and it isn&#039;t cancelable.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;template id=”comment-template”&amp;gt;&lt;br /&gt;
    &amp;lt;div&amp;gt;&amp;lt;content&amp;gt;&amp;lt;/content&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
  &amp;lt;/template&amp;gt;&lt;br /&gt;
  &amp;lt;script&amp;gt;&lt;br /&gt;
  var e = document.getElementById(&amp;quot;comment-template&amp;quot;);&lt;br /&gt;
  e.addEventListener(&amp;quot;instantiation&amp;quot;, function(evt) {&lt;br /&gt;
    evt.root.querySelector(&amp;quot;div&amp;quot;).addEventListener(&amp;quot;click&amp;quot;, function(evt) { ... });&lt;br /&gt;
  });&lt;br /&gt;
  &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element also allows a &amp;lt;tt&amp;gt;script&amp;lt;/tt&amp;gt; element as a child,&lt;br /&gt;
whose script block can access &amp;lt;tt&amp;gt;HTMLTemplateElement.current&amp;lt;/tt&amp;gt; to refer the enclosing &amp;lt;tt&amp;gt;template&amp;lt;/tt&amp;gt; element. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
  &amp;lt;template id=”comment-template”&amp;gt;&lt;br /&gt;
    &amp;lt;div&amp;gt;&amp;lt;content&amp;gt;&amp;lt;/content&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
    &amp;lt;script&amp;gt;&lt;br /&gt;
    HTMLTemplateElement.current.addEventListener(&amp;quot;instantiation&amp;quot;, function(evt) {&lt;br /&gt;
      evt.root.querySelector(&amp;quot;div&amp;quot;).addEventListener(&amp;quot;click&amp;quot;, function(evt) { ... });&lt;br /&gt;
    });&lt;br /&gt;
    &amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/template&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Isolation =&lt;br /&gt;
&lt;br /&gt;
== Standalone Form ==&lt;br /&gt;
&lt;br /&gt;
The element registration and template definition are also done in a separate HTML.&lt;br /&gt;
Each HTML file which provides the element registration should have a &amp;lt;tt&amp;gt;provide&amp;lt;/tt&amp;gt; attribute on the root html element.&lt;br /&gt;
This attribute prevents accidental loading of existing HTML files. &lt;br /&gt;
&lt;br /&gt;
Effective markup vocabulary for the providing HTML is limited.&lt;br /&gt;
Agents only recognize a head element as a child of the root element when the HTML document is loaded as required.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html provide&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;element for=&amp;quot;x-comment&amp;quot;&amp;gt;..&amp;lt;/element&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The host element can load the html with element definition using a &amp;lt;tt&amp;gt;link&amp;lt;/tt&amp;gt; element with its &amp;lt;tt&amp;gt;rel&amp;lt;/tt&amp;gt; attribute set to &amp;lt;tt&amp;gt;component&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The standalone definition can be done by a script file.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component” type=”text/javascript” href=&amp;quot;comment.js&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is equivalent to linking to a HTML file of like:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html provide&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;script type=”text/javascript” src=&amp;quot;comment.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Shared definition ==&lt;br /&gt;
&lt;br /&gt;
In the default, these definitions are coming into the host document.&lt;br /&gt;
That means a providing HTML doesn’t have its own document nor the global object. Agents use these of the host document. &lt;br /&gt;
&lt;br /&gt;
== Isolated definition ==&lt;br /&gt;
&lt;br /&gt;
If the &amp;lt;tt&amp;gt;rel&amp;lt;/tt&amp;gt; attribute contains the term &amp;lt;tt&amp;gt;isolate&amp;lt;/tt&amp;gt;, the linked HTML is loaded as a separate document object.&lt;br /&gt;
The script inside the document is given a separate global object. &lt;br /&gt;
&lt;br /&gt;
For the host document, there is no way to access the loaded document directly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
  &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;link rel=”component; isolate” type=”text/html” href=&amp;quot;comment.html&amp;quot;&amp;gt;&lt;br /&gt;
  &amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7355</id>
		<title>Component Model</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model&amp;diff=7355"/>
		<updated>2011-10-24T21:59:14Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Introduction */ add links to strawman pages&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Here&#039;s a good starting point for learning about the [https://github.com/dglazkov/component-model component model spec], which is being developed by applying a [[Component_Model_Methodology | defined methodology]].&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Component Model&#039;&#039;&#039; introduces comprehensive support for creating DOM elements. [[Component_Model_Use_Cases | Examples]] include layout managers, combinations of Dojo and jQuery widgets, isolated widgets, such as Like/+1 buttons, and built-in HTML elements themselves.  Reflecting on the experience of Mozilla&#039;s XBL  and Microsoft Internet Explorer&#039;s HTML components, the Component Model formalizes the concept of loosely coupled, coherent units of [[Behavior Attachment | behavior]]  in the [http://www.w3.org/wiki/Open_Web_Platform Web platform]. The functionality goals of the Component Model resemble  the goals of [http://dev.w3.org/2006/xbl2/ XBL2]; unlike XBL2, the Component Model seeks to be more incremental and modular while leveraging and integrating with new technologies.&lt;br /&gt;
&lt;br /&gt;
Related links:&lt;br /&gt;
* [[Behavior_Attachment | Behavior Attachment]] -- a general overview of the behavior attachment problem&lt;br /&gt;
* [[Component_Model_Methodology | Component Model Methodology]]&lt;br /&gt;
* [[Component_Model_Use_Cases | Component Model Use Cases]]&lt;br /&gt;
* [[Component_Model_Declarative_Syntax | Component Model Declarative Syntax]]&lt;br /&gt;
* [https://github.com/dglazkov/component-model Component Model Spec on Github]&lt;br /&gt;
* [http://dglazkov.github.com/component-model/ Component Model Spec Snapshot on Github Pages]&lt;br /&gt;
* [[Component_Model_Progressive_Enhancement | Component Model Progressive Enhancement]]&lt;br /&gt;
* [[Custom_Tags_Analysis | Custom Tags Analysis]]&lt;br /&gt;
&lt;br /&gt;
Discussion pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion Main discussion page with open questions]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Discussion:_Rendering Rendering-specific discussion]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_CSS_Brainstorming brainstorming page about CSS and styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Isolation_Brainstorming brainstorming page about isolation and confinement]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_IDL_Brainstorming brainstorming page about IDLs and communication across boundaries]&lt;br /&gt;
&lt;br /&gt;
Strawman pages:&lt;br /&gt;
&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Decorators Decorators]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Declarative_Syntax Declarative Syntax]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Styling Styling]&lt;br /&gt;
* [http://wiki.whatwg.org/wiki/Component_Model_Strawman:_Isolation Isolation]&lt;br /&gt;
&lt;br /&gt;
=Properties=&lt;br /&gt;
&lt;br /&gt;
The component model aims to satisfy several key properties. These properties were extracted from the [[Component_Model_Use_Cases | use cases]]. This section explains component model basics by studying each property.&lt;br /&gt;
&lt;br /&gt;
==Extensibility==&lt;br /&gt;
&lt;br /&gt;
The component model enables creation of new types of DOM elements by allowing the use of existing DOM elements in JavaScript prototype chain. For example, here&#039;s how you would create a new sub-type of HTMLElement:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
LayoutManagerPanel.prototype = Object.create(HTMLElement.prototype);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
// 1) Will not be able to add instances of LayoutManagerPanel to document without this call.&lt;br /&gt;
// 2) First parameter specifies the tagName of the element being registered and must be a string prefixed with &amp;quot;x-&amp;quot;.&lt;br /&gt;
Element.register(&amp;quot;x-layout-manager-panel&amp;quot;, LayoutManagerPanel);&lt;br /&gt;
&lt;br /&gt;
// ...&lt;br /&gt;
&lt;br /&gt;
var panel = new LayoutManagerPanel();&lt;br /&gt;
document.body.appendChild(panel);&lt;br /&gt;
// or&lt;br /&gt;
document.body.innerHTML = &amp;quot;&amp;lt;x-layout-manager-panel&amp;gt;&amp;lt;/x-layout-manager-panel&amp;gt;&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The resulting &amp;lt;code&amp;gt;panel&amp;lt;/code&amp;gt; instance is a Javascript object that is a valid DOM element, which can be added to the DOM tree. You can then extend this object using standard Javascript prototype inheritance.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
==Consistency==&lt;br /&gt;
&lt;br /&gt;
Because components are just DOM objects, they inherently share the same traversal and manipulation APIs, as defined by the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html DOM4]. The authors of components can extend these APIs by adding custom methods and properties on DOM objects, using standard JavaScript inheritance:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Widget.prototype = Object.create(HTMLElement.prototype, {&lt;br /&gt;
    update: {&lt;br /&gt;
        value: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
    value: {&lt;br /&gt;
        get: function() { /* ... */ },&lt;br /&gt;
        set: function() { /* ... */ }&lt;br /&gt;
    },&lt;br /&gt;
   // ...&lt;br /&gt;
});&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The common API surface and the ability to extend it serves as a natural API boundary for framework authors, enabling interoperability.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
&lt;br /&gt;
==Encapsulation==&lt;br /&gt;
Encapsulation refers to ability of the component to hide its implementation details and state from the document. To enable hiding of the implementation details, the component model provides a way to build a DOM tree that is not accessible from the document DOM tree, but is rendered as part of the document. This DOM tree, associated with the component is the [http://glazkov.com/2011/01/14/what-the-heck-is-shadow-dom/ shadow DOM]. The boundary between the document DOM tree and shadow DOM tree provides complete encapsulation, and ensures that:&lt;br /&gt;
* no shadow DOM tree nodes cross this boundary during event dispatch;&lt;br /&gt;
* document DOM tree has no access to nodes in the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Additionally, the boundary serves as a convenient style application lever, giving the component a choice of letting (or not letting) document CSS affect the shadow DOM tree.&lt;br /&gt;
&lt;br /&gt;
Every DOM element instance may only have (or &#039;&#039;host&#039;&#039;) one shadow DOM tree. A shadow tree is instantiated by creating an instance of the &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; object, which takes a reference to the hosting element as a parameter. Attempting to create more than one instance for the same element throws an exception:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
function LayoutManagerPanel() {&lt;br /&gt;
    HTMLElement.call(this);&lt;br /&gt;
    var shadow = new ShadowRoot(this);&lt;br /&gt;
    var shadow2 = new ShadowRoot(this); // throws an exception.&lt;br /&gt;
   // ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
&lt;br /&gt;
==Composability==&lt;br /&gt;
&lt;br /&gt;
Being DOM objects, components fit naturally into the document DOM tree and support all of its composition properties. In addition, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element allows controlling interaction between shadow and document DOM trees. A &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element specifies places where immediate document tree children of the component are rendered &#039;&#039;inside&#039;&#039; the shadow tree.&lt;br /&gt;
&lt;br /&gt;
There can be more than one &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element in the shadow tree. The &amp;lt;code&amp;gt;includes&amp;lt;/code&amp;gt; attribute provides a convenient way to sort element&#039;s children by CSS selector. For example, a &amp;lt;code&amp;gt;DockLayoutPanel&amp;lt;/code&amp;gt; component could be used like this in the document DOM tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Chauncey Gardiner.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Provided that its shadow DOM tree looks like this:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content includes=&amp;amp;quot;.west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;content&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;content includes=&amp;amp;quot;.south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;#shadow-root&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
The document DOM tree children on of &amp;lt;code&amp;gt;x-dock-layout-panel&amp;lt;/code&amp;gt; will be rendered as if composed from this tree:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;amp;lt;x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;h1 class=&amp;amp;quot;north&amp;amp;quot;&amp;amp;gt;On Gardens&amp;amp;lt;/h1&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;ul class=&amp;amp;quot;west&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Automatic Gardens&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
                &amp;amp;lt;li&amp;amp;gt;Gardening on minefields&amp;amp;lt;/li&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;/ul&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;east&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
            &amp;amp;lt;p&amp;amp;gt;I love gardening.&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;
        &amp;amp;lt;div class=&amp;amp;quot;south&amp;amp;quot;&amp;amp;gt;Written by Avid Gardener.&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
    &amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;
&amp;amp;lt;/x-dock-layout-panel&amp;amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Desugaring==&lt;br /&gt;
The component model also explains pretty well how the native HTML elements are built and dispels some of the magic associated with the &amp;quot;DOM object vs. JavaScript object&amp;quot; juxtaposition.&lt;br /&gt;
&lt;br /&gt;
Allowing DOM elements to participate in the JavaScript inheritance chain makes DOM elements more approachable and easier to work with.&lt;br /&gt;
&lt;br /&gt;
Complex DOM elements that are rendered with more than one CSS box (and aren&#039;t specified in terms of CSS, like [http://dev.w3.org/csswg/css3-lists/ lists]) are just components that have shadow DOM. Coincidentally, this also explains why you can&#039;t add shadow DOM subtrees to &amp;lt;code&amp;gt;input&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;details&amp;lt;/code&amp;gt; elements -- their &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;s are claimed by &amp;lt;code&amp;gt;HTMLInputElement&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;HTMLDetailsElement&amp;lt;/code&amp;gt; constructors, respectively.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
* [[#Content_Element | Content Element]]&lt;br /&gt;
&lt;br /&gt;
==Performance==&lt;br /&gt;
Considering the way Web works, the component model must allow decoupling of the instantiation and the declaration of the components in order to provide reasonable performance characteristics. It&#039;s an unfortunate, but necessary requirement. In other words, we must be able to handle situations where a component instance is created before it is declared. Here&#039;s an simple example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
// somewhere in view.js&lt;br /&gt;
...&lt;br /&gt;
document.body.innerHTML = &#039;&amp;lt;div class=&amp;quot;awesome&amp;quot;&amp;gt;&amp;lt;x-layout&amp;gt;&amp;lt;x-spring-panel&amp;gt;...&amp;lt;/x-spring-panel&amp;gt;&amp;lt;/x-layout&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
// somewhere in layout.js&lt;br /&gt;
Element.register(&#039;x-layout&#039;, Layout);&lt;br /&gt;
Element.register(&#039;x-spring-panel&#039;, SpringPanel);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this situation, there is no room for error: &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt; &#039;&#039;must&#039;&#039; wait for &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; to load before executing. You can&#039;t load &amp;lt;code&amp;gt;layout.js&amp;lt;/code&amp;gt; lazily or in any different order, since it defines the components that are used in &amp;lt;code&amp;gt;view.js&amp;lt;/code&amp;gt;. Given that asynchronous, deferred or lazy-loading of script are all common performance techniques in today&#039;s Web, we must do better than block or throw an exception in such cases.&lt;br /&gt;
&lt;br /&gt;
The component model offers this solution:&lt;br /&gt;
&lt;br /&gt;
When an unknown DOM element with an &amp;quot;x-&amp;quot;-prefixed &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt; is encountered, we put a placeholder &amp;lt;code&amp;gt;HTMLUnknownElement&amp;lt;/code&amp;gt; instance in its place. As soon as the element is defined, all placeholder instances are replaced ([http://www.w3.org/TR/DOM-Level-3-Core/core.html#Document3-renameNode Document.renameNode]) with the new, proper DOM element.&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Registering_Elements | Registering Elements]]&lt;br /&gt;
&lt;br /&gt;
== Confinement ==&lt;br /&gt;
Confinement refers to the document protecting its implementation details and state from the component and can be viewed as the inverse of [[#Encapsulation | encapsulation]].&lt;br /&gt;
&lt;br /&gt;
Required Building Blocks:&lt;br /&gt;
* [[#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks=&lt;br /&gt;
&lt;br /&gt;
The component model is comprised of the following building blocks.&lt;br /&gt;
&lt;br /&gt;
==Shadow DOM==&lt;br /&gt;
&lt;br /&gt;
Any DOM element can host a shadow DOM subtree. The shadow DOM subtree originates at &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt;, which is coupled the hosting element at the time of its construction. You don&#039;t need any other building blocks in order to take advantage of the shadow DOM:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
var element = document.createElement(&amp;quot;div&amp;quot;);&lt;br /&gt;
var shadow = new ShadowRoot(element);&lt;br /&gt;
shadow.appendChild(document.createElement(&amp;quot;p&amp;quot;)).textContent = &amp;quot;weee!!&#039;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; instance is a [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-node Node], and acts as the root of the element&#039;s shadow DOM subtree. The &amp;lt;code&amp;gt;ShadowRoot&amp;lt;/code&amp;gt; itself is never rendered, nor has styles. In this regard, it&#039;s similar to the [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-documentfragment DocumentFragment]. It has two properties:&lt;br /&gt;
* &amp;lt;code&amp;gt;applyAuthorSheets&amp;lt;/code&amp;gt;, which is either &#039;&#039;&#039;true&#039;&#039;&#039; (that is, apply author style sheets from the document), or &#039;&#039;&#039;false&#039;&#039;&#039; (don&#039;t);&lt;br /&gt;
* &amp;lt;code&amp;gt;shadowHost&amp;lt;/code&amp;gt;, which points to the hosting element.&lt;br /&gt;
&lt;br /&gt;
==Content Element==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; element is used with [[#Shadow_DOM | Shadow DOM]] and provides a mechanism for distributing hosting element&#039;s children inside of its shadow subtree. To preserve the [[#Encapsulation | encapsulation]] property, the &amp;lt;code&amp;gt;content&amp;lt;/code&amp;gt; elements act as insertion points and do not leak any information about hosting element&#039;s children to the shadow DOM subtree or vise versa.&lt;br /&gt;
&lt;br /&gt;
==Constructable DOM Types==&lt;br /&gt;
The inability to construct DOM element using &amp;lt;code&amp;gt;new&amp;lt;/code&amp;gt; (with some exceptions) or use them in the prototype inheritance chain had confounded many Web developers since the beginning of DOM. This building block intends to rectify at least the latter by allowing &amp;lt;code&amp;gt;HTMLElement.call&amp;lt;/code&amp;gt; invocation and thus enabling creation of JavaScript objects with DOM elements in the prototype chain.&lt;br /&gt;
&lt;br /&gt;
==Registering Elements==&lt;br /&gt;
Working in conjunction with  [[#Constructable_DOM_Types | Constructable DOM Types]], this building block makes the list of valid markup tag names extensible by exposing &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
partial interface Element {&lt;br /&gt;
    static void register(in String tagName, in Function constructor);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It is possible to envisage a milder (though less elegant) version of element registration by keeping DOM element construction magical (thus decoupling it from [[#Constructable_DOM_Types | Constructable DOM Types]]) and making &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; use a callback, rather than &amp;lt;code&amp;gt;constructor&amp;lt;/code&amp;gt; as parameter. The callback would be invoked with an already-constructed DOM object with the specified &amp;lt;code&amp;gt;tagName&amp;lt;/code&amp;gt;, leaving the work of setting up properties on this object to the callback.&lt;br /&gt;
&lt;br /&gt;
==Confinement Primitives==&lt;br /&gt;
&lt;br /&gt;
The API surface of the component model lends itself well to proper confinement. Here&#039;s an approach that could be used to provide it (very early brainstorming):&lt;br /&gt;
&lt;br /&gt;
* Confinement is not tied to the component model. Instead, it&#039;s a new twist on the method of loading scripts. A script could be loaded as usual or it could be &#039;&#039;confined&#039;&#039;, or loaded into its own context.&lt;br /&gt;
&lt;br /&gt;
* When confined, a script has its own global and document objects. These objects only reveal some safe limited subset of the actual document objects.  Think of it as a same-origin iframe with restrictions on document and window.&lt;br /&gt;
&lt;br /&gt;
* You can communicate with the main document using &amp;lt;code&amp;gt;window.postMessage&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* The confined document DOM tree is always empty. Attempting to insert into it throws exceptions.&lt;br /&gt;
&lt;br /&gt;
* ... except when you append to elements in shadow DOM. That&#039;s right, you can do &amp;lt;code&amp;gt;Element.register&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;new ShadowRoot&amp;lt;/code&amp;gt; in the confined document.&lt;br /&gt;
&lt;br /&gt;
* Whenever you register an element, it registers &#039;&#039;in the main document&#039;&#039; as well. Creating an instance of a component from an confined document produces a functional DOM element shell that proxies to the actual element in the confined document.&lt;br /&gt;
&lt;br /&gt;
Proposed API: introduce a new &amp;lt;code&amp;gt;confined&amp;lt;/code&amp;gt; attribute to the &amp;lt;code&amp;gt;script&amp;lt;/code&amp;gt; element. Presence of this attribute triggers loading scripts in the confined context.&lt;br /&gt;
&lt;br /&gt;
Confinement of script execution could be useful outside of the component model and also could be related to [https://dvcs.w3.org/hg/content-security-policy/raw-file/tip/csp-specification.dev.html Content Security Policy].&lt;br /&gt;
&lt;br /&gt;
* [[Component_Model_Isolation_Brainstorming | Isolation Brainstorm]]&lt;br /&gt;
&lt;br /&gt;
=Building Blocks Use Case Coverage=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a list of building blocks, tabulated against the [[Component_Model_Use_Cases | use cases]] and approximate percentage of satisfying them:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | Building Block&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Layout_Manager | Layout Manager]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Widget_Mix-and-Match | Mix-and-Match]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Rendering_Form_Controls_with_SVG | SVG Controls]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Contacts_Widget | Contacts Widget]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Like.2F.2B1_Button | Like/+1 Button]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Media_Controls_For_The_Video_Element | Media Controls for the Video Element]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | [[Component_Model_Use_Cases#Details.2FSummary_Elements | Details/Summary Element]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Shadow_DOM | Shadow DOM]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| 34%&lt;br /&gt;
| 100%&lt;br /&gt;
| 25%&lt;br /&gt;
| 100%&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Content_Element | Content Element]]&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 50%&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Constructable_DOM_Types | Constructable DOM Types]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Registering_Elements | Registering Elements]]&lt;br /&gt;
| 25%&lt;br /&gt;
| 50%&lt;br /&gt;
| 33%&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
| [[Component_Model#Confinement_Primitives | Confinement Primitives]]&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
| 25%&lt;br /&gt;
| -&lt;br /&gt;
| -&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=Comparison With Existing Specs and Implementations=&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a brief overview of existing similar specifications and implementations:&lt;br /&gt;
* [http://msdn.microsoft.com/en-us/library/ms531018(v=vs.85).aspx HTML Components] is a [http://windows.microsoft.com/en-US/internet-explorer/products/ie/home Microsoft Internet Explorer]-specific method of creating custom DOM elements. Also see [http://www.w3.org/TR/NOTE-HTMLComponents HTML Components Note] (implemented in IE5+).&lt;br /&gt;
* [http://www.w3.org/TR/2001/NOTE-xbl-20010223/ XBL], currently implemented in Mozilla.&lt;br /&gt;
* [http://dev.w3.org/2006/xbl2/ XBL2], the ancestral spec of the Component Model, and a revision of XBL.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a handy overview of how each of these specs satisfies the component model [[#Properties | properties]]:&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;10&amp;quot; cellspacing=&amp;quot;0&amp;quot; style=&amp;quot;border-collapse: collapse;&amp;quot;&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | Spec/Implementation&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Extensibility | Extensibility]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Consistency | Consistency]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Encapsulation | Encapsulation]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Composability | Composability]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Desugaring | Desugaring]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Performance | Performance]]&lt;br /&gt;
! align=&amp;quot;left&amp;quot; width=&amp;quot;12%&amp;quot; | [[#Confinement | Confinement]]&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | HTML Components&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Components are magic, inextensible objects.&lt;br /&gt;
| &#039;&#039;&#039;Almost&#039;&#039;&#039;. Implementation provides ways to add properties, methods, events to element API, and the components are &#039;&#039;almost&#039;&#039; DOM elements. However, custom tags don&#039;t support all properties of a DOM element.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. There are some provisions for event encapsulation, nothing else.&lt;br /&gt;
| &#039;&#039;&#039;Not much&#039;&#039;&#039;. No provisions for handling document children vs. component-defined children.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The mechanism for extending bindings is entirely independent of DOM type or Javascript extensibility.&lt;br /&gt;
| &#039;&#039;&#039;Yes-ish&#039;&#039;&#039;. Bindings can override properties on the DOM element, although the mechanism is highly unnatural (XML declarations).&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;? Hard to say looking at TR note.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;. Some HTML elements in Gecko are implemented using it.&lt;br /&gt;
| &#039;&#039;&#039;Not sure&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|- valign=&amp;quot;top&amp;quot; style=&amp;quot;border-bottom: 1px solid LightGray;&amp;quot;&lt;br /&gt;
! align=&amp;quot;left&amp;quot; | XBL2&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Same as XBL.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. Bindings are discouraged from establishing an API surface on a bound element.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;Yes&#039;&#039;&#039;.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;. The spec didn&#039;t intend to describe how native elements are built.&lt;br /&gt;
| &#039;&#039;&#039;Somewhat&#039;&#039;&#039;. The lifecycle of a binding is well-defined and initialization stages are well-decoupled. However, there is no way to build a binding imperatively without loading a binding document.&lt;br /&gt;
| &#039;&#039;&#039;No&#039;&#039;&#039;.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The key differences between XBL2 and the Component Model are:&lt;br /&gt;
* The Component Model fully embraces the [[Behavior_Attachment#Behavior_Attachment_Methods | element behavior attachment]] by allowing creation of new types of DOM elements within a document. This is something Web Framework developers always wanted and repeatedly try to do with parallel object hierarchies. Eliminating ephemerality of the attachment simplifies and clarifies how things work conceptually -- there is no longer a place for &amp;quot;spooky action at a distance&amp;quot;, caused by a change of a random CSS selector or even removing an element from the tree.&lt;br /&gt;
* The Component Model is strongly biased toward reusing existing bits of the platform and well-established techniques instead of inventing new ones. For instance, instead of bindings inheritance, we rely on prototype inheritance. Instead of endeavoring to solve the incredibly complex, yet dubious problem of multiple bindings or shadow DOM trees, we simply suggest composition.&lt;br /&gt;
* The Component Model strives to add capabilities in layers (see [[#Building_Blocks | building blocks]]), each able to function on its own. The omnibus nature of XBL2 removes opportunities for layering, particularly as element identity, life cycle, and scripting are concerned. Perhaps this could be repaired somehow, but Component Model solves these issues without further complicating an already large, difficult to understand spec.&lt;br /&gt;
&lt;br /&gt;
[[Category:Proposals]]&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7354</id>
		<title>Component Model Decorator Brainstorming</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Decorator_Brainstorming&amp;diff=7354"/>
		<updated>2011-10-24T21:57:27Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: creating the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Stub&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7353</id>
		<title>Component Model Strawman: Styling</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Styling&amp;diff=7353"/>
		<updated>2011-10-24T21:57:02Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: creating the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Stub&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Declarative_Syntax&amp;diff=7352</id>
		<title>Component Model Strawman: Declarative Syntax</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Declarative_Syntax&amp;diff=7352"/>
		<updated>2011-10-24T21:56:44Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: creating the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Stub&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7351</id>
		<title>Component Model Strawman: Isolation</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Strawman:_Isolation&amp;diff=7351"/>
		<updated>2011-10-24T21:56:20Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: creating the page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Stub&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7340</id>
		<title>Component Model Discussion: Rendering</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7340"/>
		<updated>2011-10-21T04:26:57Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* [F2] neither host element nor shadow root rendered, shadow root has single child &amp;amp;lt;R&amp;amp;gt; as root element */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The question asked herein is how to best treat the following somewhat mutually exclusive requirements:&lt;br /&gt;
&lt;br /&gt;
[1] The containing document &amp;quot;wants&amp;quot; to naturally style the host element (using &amp;lt;x-foo&amp;gt; notation here - see the [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Registration Component Registration page] for alternatives). E.g.,&lt;br /&gt;
&lt;br /&gt;
  x-foo {&lt;br /&gt;
      background-color: yellow;&lt;br /&gt;
      border: 1px solid blue;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
[2] The component &amp;quot;wants&amp;quot; to be able to style its outermost rendering rectangle. Because of [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Isolation Isolation], this rectangle is ideally located within the component, i.e., within the shadow DOM.&lt;br /&gt;
&lt;br /&gt;
and as a somewhat lesser concern:&lt;br /&gt;
&lt;br /&gt;
[3] Every point between the rectangles should correspond to a valid DOM range.&lt;br /&gt;
&lt;br /&gt;
ad [3]: Note that conversely, in no variant there is a mapping from a DOM range with anchor &amp;lt;x-foo&amp;gt; to a rectangle/screen position, since the children of &amp;lt;x-foo&amp;gt; may be rendered in arbitrary places, depending on &amp;lt;content&amp;gt; elements within the shadow DOM, or even not at all.&lt;br /&gt;
&lt;br /&gt;
== Rendering ==&lt;br /&gt;
&lt;br /&gt;
This consists of the following, more or less orthogonal, sub-questions&lt;br /&gt;
&lt;br /&gt;
* is the host element rendered or not?&lt;br /&gt;
* is the shadow root rendered or not?&lt;br /&gt;
* is the shadow root an element or a separate node type?&lt;br /&gt;
* using &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
Almost all combinations of the above have their respective merits and problems. Assume we have the following DOM structure:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;A&amp;gt;&lt;br /&gt;
    &amp;lt;x-foo&amp;gt; -----&amp;gt; [ShadowRoot (S)]&lt;br /&gt;
      &amp;lt;B/&amp;gt;            &amp;lt;Y/&amp;gt;&lt;br /&gt;
      &amp;lt;C/&amp;gt;            &amp;lt;Z/&amp;gt;&lt;br /&gt;
      &amp;lt;D/&amp;gt;&lt;br /&gt;
    &amp;lt;/x-foo&amp;gt;&lt;br /&gt;
  &amp;lt;/A&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This could conceivably be rendered in the following ways:&lt;br /&gt;
&lt;br /&gt;
=== [A] rendered host element, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------------------------------------+&lt;br /&gt;
  |       x-foo-------------------------------------------------+       |&lt;br /&gt;
  |       |       SR------------------------------------+       |       |&lt;br /&gt;
  |       |       |       Y------+       Z------+       |       |       |&lt;br /&gt;
  | [A,0] |  ???  | [S,0] |      | [S,1] |      | [S,2] |  ???  | [A,1] |&lt;br /&gt;
  |       |       |       +------+       +------+       |       |       |&lt;br /&gt;
  |       |       +-------------------------------------+       |       |&lt;br /&gt;
  |       +-----------------------------------------------------+       |&lt;br /&gt;
  +---------------------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Styles set on &amp;lt;x-foo&amp;gt; such as &amp;lt;code&amp;gt;background-color&amp;lt;/code&amp;gt; don&#039;t really affect the component&#039;s rendering if the component overrides them on the shadow root.&lt;br /&gt;
* The potential gaps between the shadow root&#039;s rectangle and the outer host element&#039;s rectangle don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [B] rendered host element with default &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  |       :SR------------------------------------+:       |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  | [A,0] :| [S,0] |      | [S,1] |      | [S,2] |: [A,1] |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  |       :+-------------------------------------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [A], with the associated issues.&lt;br /&gt;
&lt;br /&gt;
=== [C] rendered host element, rendered shadow root, shadow root is separate node type, shadow root&#039;s rectangle always is the same as the host element&#039;s (no gap) ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo-----------------------------------+       |&lt;br /&gt;
  |       |SR------------------------------------+|       |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  | [A,0] || [S,0] |      | [S,1] |      | [S,2] || [A,1] |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  |       |+-------------------------------------+|       |&lt;br /&gt;
  |       +---------------------------------------+       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
This allows both the document to style &amp;lt;x-foo&amp;gt;, as well as allowing the component to have its own outer rectangle, but prevents any gap from forming between them. However, this raises more questions than it answers:&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Need to spec how ShadowRoot node type is styleable&lt;br /&gt;
* &amp;lt;code&amp;gt;margin&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;padding&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;position&amp;lt;/code&amp;gt; et al must not apply, so need to define how styles apply to ShadowRoot in detail.&lt;br /&gt;
&lt;br /&gt;
=== [D] rendered host element, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       x-foo---------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] |  ???  |      |  ???  |      |  ???  | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Confinement requires separate style-sheet in order for the component to be able to style the host element.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [E] host element has &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt; by default, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - +       |&lt;br /&gt;
  |       :Y------+       Z------+:       |&lt;br /&gt;
  |  ???  :|      |  ???  |      |:  ???  |&lt;br /&gt;
  |       :+------+       +------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - +       |&lt;br /&gt;
  +---------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [D], with the associated issues.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [F] host element not rendered, rendered shadow root ===&lt;br /&gt;
&lt;br /&gt;
In this scenario, the ShadowRoot most likely is an element.&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       SR------------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] | [S,0] |      | [S,1] |      | [S,2] | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host. Because of Isolation it also can&#039;t style the ShadowRoot, unless styles styles set on &amp;amp;lt;x-foo&amp;amp;gt; are forwarded somehow. If so, mechanism of style forwarding needs to be specced.&lt;br /&gt;
&lt;br /&gt;
=== [F2] neither host element nor shadow root rendered, shadow root has single child &amp;amp;lt;R&amp;amp;gt; as root element ===&lt;br /&gt;
&lt;br /&gt;
Similar to [F], but the ShadowRoot doesn&#039;t have to be an element itself, can be extended towards [G] later on.&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       R-------------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] | [S,0] |      | [S,1] |      | [S,2] | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host. Because of Isolation it also can&#039;t style the ShadowRoot nor the shadow root element, unless styles styles set on &amp;amp;lt;x-foo&amp;amp;gt; are forwarded somehow. If so, mechanism of style forwarding needs to be specced.&lt;br /&gt;
&lt;br /&gt;
=== [G] neither host element nor shadow root rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------+&lt;br /&gt;
  |       Y------+       Z------+       |&lt;br /&gt;
  |  ???  |      |  ???  |      |  ???  |&lt;br /&gt;
  |       +------+       +------+       |&lt;br /&gt;
  +-------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Undoubtedly the most flexible from a layout perspective, as it allows a single element to &amp;quot;create&amp;quot; multiple renderers.&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* There is no single rendering rectangle corresponding to &amp;lt;x-foo&amp;gt;.&lt;br /&gt;
* Containing document can&#039;t style the host element. Styles set on &amp;lt;x-foo&amp;gt; could be forwarded to ALL children of the shadow root, but it&#039;s not clear this is useful.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the host element&#039;s parent don&#039;t directly map to a DOM position.&lt;br /&gt;
&lt;br /&gt;
=== [Z] Other? ===&lt;br /&gt;
&lt;br /&gt;
There is a marvelous variant that solves all issues and doesn&#039;t suffer any of the above drawbacks which this paragraph is too small to contain.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
Currently we implemented variant [D].&lt;br /&gt;
&lt;br /&gt;
We probably want to go towards [F2].&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7339</id>
		<title>Component Model Discussion: Rendering</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7339"/>
		<updated>2011-10-21T04:12:55Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* Current State */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The question asked herein is how to best treat the following somewhat mutually exclusive requirements:&lt;br /&gt;
&lt;br /&gt;
[1] The containing document &amp;quot;wants&amp;quot; to naturally style the host element (using &amp;lt;x-foo&amp;gt; notation here - see the [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Registration Component Registration page] for alternatives). E.g.,&lt;br /&gt;
&lt;br /&gt;
  x-foo {&lt;br /&gt;
      background-color: yellow;&lt;br /&gt;
      border: 1px solid blue;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
[2] The component &amp;quot;wants&amp;quot; to be able to style its outermost rendering rectangle. Because of [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Isolation Isolation], this rectangle is ideally located within the component, i.e., within the shadow DOM.&lt;br /&gt;
&lt;br /&gt;
and as a somewhat lesser concern:&lt;br /&gt;
&lt;br /&gt;
[3] Every point between the rectangles should correspond to a valid DOM range.&lt;br /&gt;
&lt;br /&gt;
ad [3]: Note that conversely, in no variant there is a mapping from a DOM range with anchor &amp;lt;x-foo&amp;gt; to a rectangle/screen position, since the children of &amp;lt;x-foo&amp;gt; may be rendered in arbitrary places, depending on &amp;lt;content&amp;gt; elements within the shadow DOM, or even not at all.&lt;br /&gt;
&lt;br /&gt;
== Rendering ==&lt;br /&gt;
&lt;br /&gt;
This consists of the following, more or less orthogonal, sub-questions&lt;br /&gt;
&lt;br /&gt;
* is the host element rendered or not?&lt;br /&gt;
* is the shadow root rendered or not?&lt;br /&gt;
* is the shadow root an element or a separate node type?&lt;br /&gt;
* using &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
Almost all combinations of the above have their respective merits and problems. Assume we have the following DOM structure:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;A&amp;gt;&lt;br /&gt;
    &amp;lt;x-foo&amp;gt; -----&amp;gt; [ShadowRoot (S)]&lt;br /&gt;
      &amp;lt;B/&amp;gt;            &amp;lt;Y/&amp;gt;&lt;br /&gt;
      &amp;lt;C/&amp;gt;            &amp;lt;Z/&amp;gt;&lt;br /&gt;
      &amp;lt;D/&amp;gt;&lt;br /&gt;
    &amp;lt;/x-foo&amp;gt;&lt;br /&gt;
  &amp;lt;/A&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This could conceivably be rendered in the following ways:&lt;br /&gt;
&lt;br /&gt;
=== [A] rendered host element, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------------------------------------+&lt;br /&gt;
  |       x-foo-------------------------------------------------+       |&lt;br /&gt;
  |       |       SR------------------------------------+       |       |&lt;br /&gt;
  |       |       |       Y------+       Z------+       |       |       |&lt;br /&gt;
  | [A,0] |  ???  | [S,0] |      | [S,1] |      | [S,2] |  ???  | [A,1] |&lt;br /&gt;
  |       |       |       +------+       +------+       |       |       |&lt;br /&gt;
  |       |       +-------------------------------------+       |       |&lt;br /&gt;
  |       +-----------------------------------------------------+       |&lt;br /&gt;
  +---------------------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Styles set on &amp;lt;x-foo&amp;gt; such as &amp;lt;code&amp;gt;background-color&amp;lt;/code&amp;gt; don&#039;t really affect the component&#039;s rendering if the component overrides them on the shadow root.&lt;br /&gt;
* The potential gaps between the shadow root&#039;s rectangle and the outer host element&#039;s rectangle don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [B] rendered host element with default &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  |       :SR------------------------------------+:       |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  | [A,0] :| [S,0] |      | [S,1] |      | [S,2] |: [A,1] |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  |       :+-------------------------------------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [A], with the associated issues.&lt;br /&gt;
&lt;br /&gt;
=== [C] rendered host element, rendered shadow root, shadow root is separate node type, shadow root&#039;s rectangle always is the same as the host element&#039;s (no gap) ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo-----------------------------------+       |&lt;br /&gt;
  |       |SR------------------------------------+|       |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  | [A,0] || [S,0] |      | [S,1] |      | [S,2] || [A,1] |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  |       |+-------------------------------------+|       |&lt;br /&gt;
  |       +---------------------------------------+       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
This allows both the document to style &amp;lt;x-foo&amp;gt;, as well as allowing the component to have its own outer rectangle, but prevents any gap from forming between them. However, this raises more questions than it answers:&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Need to spec how ShadowRoot node type is styleable&lt;br /&gt;
* &amp;lt;code&amp;gt;margin&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;padding&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;position&amp;lt;/code&amp;gt; et al must not apply, so need to define how styles apply to ShadowRoot in detail.&lt;br /&gt;
&lt;br /&gt;
=== [D] rendered host element, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       x-foo---------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] |  ???  |      |  ???  |      |  ???  | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Confinement requires separate style-sheet in order for the component to be able to style the host element.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [E] host element has &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt; by default, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - +       |&lt;br /&gt;
  |       :Y------+       Z------+:       |&lt;br /&gt;
  |  ???  :|      |  ???  |      |:  ???  |&lt;br /&gt;
  |       :+------+       +------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - +       |&lt;br /&gt;
  +---------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [D], with the associated issues.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [F] host element not rendered, rendered shadow root ===&lt;br /&gt;
&lt;br /&gt;
In this scenario, the ShadowRoot most likely is an element.&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       SR------------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] | [S,0] |      | [S,1] |      | [S,2] | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host. Because of Isolation it also can&#039;t style the ShadowRoot, unless styles styles set on &amp;amp;lt;x-foo&amp;amp;gt; are forwarded somehow. If so, mechanism of style forwarding needs to be specced.&lt;br /&gt;
&lt;br /&gt;
=== [F2] neither host element nor shadow root rendered, shadow root has single child &amp;amp;lt;R&amp;amp;gt; as root element ===&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       R-------------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] | [S,0] |      | [S,1] |      | [S,2] | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host. Because of Isolation it also can&#039;t style the ShadowRoot nor the shadow root element, unless styles styles set on &amp;amp;lt;x-foo&amp;amp;gt; are forwarded somehow. If so, mechanism of style forwarding needs to be specced.&lt;br /&gt;
&lt;br /&gt;
=== [G] neither host element nor shadow root rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------+&lt;br /&gt;
  |       Y------+       Z------+       |&lt;br /&gt;
  |  ???  |      |  ???  |      |  ???  |&lt;br /&gt;
  |       +------+       +------+       |&lt;br /&gt;
  +-------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Undoubtedly the most flexible from a layout perspective, as it allows a single element to &amp;quot;create&amp;quot; multiple renderers.&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* There is no single rendering rectangle corresponding to &amp;lt;x-foo&amp;gt;.&lt;br /&gt;
* Containing document can&#039;t style the host element. Styles set on &amp;lt;x-foo&amp;gt; could be forwarded to ALL children of the shadow root, but it&#039;s not clear this is useful.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the host element&#039;s parent don&#039;t directly map to a DOM position.&lt;br /&gt;
&lt;br /&gt;
=== [Z] Other? ===&lt;br /&gt;
&lt;br /&gt;
There is a marvelous variant that solves all issues and doesn&#039;t suffer any of the above drawbacks which this paragraph is too small to contain.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
Currently we implemented variant [D].&lt;br /&gt;
&lt;br /&gt;
We probably want to go towards [F2].&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7338</id>
		<title>Component Model Discussion: Rendering</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7338"/>
		<updated>2011-10-21T04:00:12Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* [F] host element not rendered, rendered shadow root */ add variant for [F]&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The question asked herein is how to best treat the following somewhat mutually exclusive requirements:&lt;br /&gt;
&lt;br /&gt;
[1] The containing document &amp;quot;wants&amp;quot; to naturally style the host element (using &amp;lt;x-foo&amp;gt; notation here - see the [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Registration Component Registration page] for alternatives). E.g.,&lt;br /&gt;
&lt;br /&gt;
  x-foo {&lt;br /&gt;
      background-color: yellow;&lt;br /&gt;
      border: 1px solid blue;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
[2] The component &amp;quot;wants&amp;quot; to be able to style its outermost rendering rectangle. Because of [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Isolation Isolation], this rectangle is ideally located within the component, i.e., within the shadow DOM.&lt;br /&gt;
&lt;br /&gt;
and as a somewhat lesser concern:&lt;br /&gt;
&lt;br /&gt;
[3] Every point between the rectangles should correspond to a valid DOM range.&lt;br /&gt;
&lt;br /&gt;
ad [3]: Note that conversely, in no variant there is a mapping from a DOM range with anchor &amp;lt;x-foo&amp;gt; to a rectangle/screen position, since the children of &amp;lt;x-foo&amp;gt; may be rendered in arbitrary places, depending on &amp;lt;content&amp;gt; elements within the shadow DOM, or even not at all.&lt;br /&gt;
&lt;br /&gt;
== Rendering ==&lt;br /&gt;
&lt;br /&gt;
This consists of the following, more or less orthogonal, sub-questions&lt;br /&gt;
&lt;br /&gt;
* is the host element rendered or not?&lt;br /&gt;
* is the shadow root rendered or not?&lt;br /&gt;
* is the shadow root an element or a separate node type?&lt;br /&gt;
* using &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
Almost all combinations of the above have their respective merits and problems. Assume we have the following DOM structure:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;A&amp;gt;&lt;br /&gt;
    &amp;lt;x-foo&amp;gt; -----&amp;gt; [ShadowRoot (S)]&lt;br /&gt;
      &amp;lt;B/&amp;gt;            &amp;lt;Y/&amp;gt;&lt;br /&gt;
      &amp;lt;C/&amp;gt;            &amp;lt;Z/&amp;gt;&lt;br /&gt;
      &amp;lt;D/&amp;gt;&lt;br /&gt;
    &amp;lt;/x-foo&amp;gt;&lt;br /&gt;
  &amp;lt;/A&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This could conceivably be rendered in the following ways:&lt;br /&gt;
&lt;br /&gt;
=== [A] rendered host element, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------------------------------------+&lt;br /&gt;
  |       x-foo-------------------------------------------------+       |&lt;br /&gt;
  |       |       SR------------------------------------+       |       |&lt;br /&gt;
  |       |       |       Y------+       Z------+       |       |       |&lt;br /&gt;
  | [A,0] |  ???  | [S,0] |      | [S,1] |      | [S,2] |  ???  | [A,1] |&lt;br /&gt;
  |       |       |       +------+       +------+       |       |       |&lt;br /&gt;
  |       |       +-------------------------------------+       |       |&lt;br /&gt;
  |       +-----------------------------------------------------+       |&lt;br /&gt;
  +---------------------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Styles set on &amp;lt;x-foo&amp;gt; such as &amp;lt;code&amp;gt;background-color&amp;lt;/code&amp;gt; don&#039;t really affect the component&#039;s rendering if the component overrides them on the shadow root.&lt;br /&gt;
* The potential gaps between the shadow root&#039;s rectangle and the outer host element&#039;s rectangle don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [B] rendered host element with default &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  |       :SR------------------------------------+:       |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  | [A,0] :| [S,0] |      | [S,1] |      | [S,2] |: [A,1] |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  |       :+-------------------------------------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [A], with the associated issues.&lt;br /&gt;
&lt;br /&gt;
=== [C] rendered host element, rendered shadow root, shadow root is separate node type, shadow root&#039;s rectangle always is the same as the host element&#039;s (no gap) ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo-----------------------------------+       |&lt;br /&gt;
  |       |SR------------------------------------+|       |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  | [A,0] || [S,0] |      | [S,1] |      | [S,2] || [A,1] |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  |       |+-------------------------------------+|       |&lt;br /&gt;
  |       +---------------------------------------+       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
This allows both the document to style &amp;lt;x-foo&amp;gt;, as well as allowing the component to have its own outer rectangle, but prevents any gap from forming between them. However, this raises more questions than it answers:&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Need to spec how ShadowRoot node type is styleable&lt;br /&gt;
* &amp;lt;code&amp;gt;margin&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;padding&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;position&amp;lt;/code&amp;gt; et al must not apply, so need to define how styles apply to ShadowRoot in detail.&lt;br /&gt;
&lt;br /&gt;
=== [D] rendered host element, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       x-foo---------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] |  ???  |      |  ???  |      |  ???  | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Confinement requires separate style-sheet in order for the component to be able to style the host element.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [E] host element has &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt; by default, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - +       |&lt;br /&gt;
  |       :Y------+       Z------+:       |&lt;br /&gt;
  |  ???  :|      |  ???  |      |:  ???  |&lt;br /&gt;
  |       :+------+       +------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - +       |&lt;br /&gt;
  +---------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [D], with the associated issues.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [F] host element not rendered, rendered shadow root ===&lt;br /&gt;
&lt;br /&gt;
In this scenario, the ShadowRoot most likely is an element.&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       SR------------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] | [S,0] |      | [S,1] |      | [S,2] | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host. Because of Isolation it also can&#039;t style the ShadowRoot, unless styles styles set on &amp;amp;lt;x-foo&amp;amp;gt; are forwarded somehow. If so, mechanism of style forwarding needs to be specced.&lt;br /&gt;
&lt;br /&gt;
=== [F2] neither host element nor shadow root rendered, shadow root has single child &amp;amp;lt;R&amp;amp;gt; as root element ===&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       R-------------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] | [S,0] |      | [S,1] |      | [S,2] | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host. Because of Isolation it also can&#039;t style the ShadowRoot nor the shadow root element, unless styles styles set on &amp;amp;lt;x-foo&amp;amp;gt; are forwarded somehow. If so, mechanism of style forwarding needs to be specced.&lt;br /&gt;
&lt;br /&gt;
=== [G] neither host element nor shadow root rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------+&lt;br /&gt;
  |       Y------+       Z------+       |&lt;br /&gt;
  |  ???  |      |  ???  |      |  ???  |&lt;br /&gt;
  |       +------+       +------+       |&lt;br /&gt;
  +-------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Undoubtedly the most flexible from a layout perspective, as it allows a single element to &amp;quot;create&amp;quot; multiple renderers.&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* There is no single rendering rectangle corresponding to &amp;lt;x-foo&amp;gt;.&lt;br /&gt;
* Containing document can&#039;t style the host element. Styles set on &amp;lt;x-foo&amp;gt; could be forwarded to ALL children of the shadow root, but it&#039;s not clear this is useful.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the host element&#039;s parent don&#039;t directly map to a DOM position.&lt;br /&gt;
&lt;br /&gt;
=== [Z] Other? ===&lt;br /&gt;
&lt;br /&gt;
There is a marvelous variant that solves all issues and doesn&#039;t suffer any of the above drawbacks which this paragraph is too small to contain.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
Currently we implemented variant [D].&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
	<entry>
		<id>https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7336</id>
		<title>Component Model Discussion: Rendering</title>
		<link rel="alternate" type="text/html" href="https://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Rendering&amp;diff=7336"/>
		<updated>2011-10-21T01:58:21Z</updated>

		<summary type="html">&lt;p&gt;Rolandsteiner: /* [F] host element not rendered, rendered shadow root */ Fix incorrect statement about DOM positions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The question asked herein is how to best treat the following somewhat mutually exclusive requirements:&lt;br /&gt;
&lt;br /&gt;
[1] The containing document &amp;quot;wants&amp;quot; to naturally style the host element (using &amp;lt;x-foo&amp;gt; notation here - see the [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Registration Component Registration page] for alternatives). E.g.,&lt;br /&gt;
&lt;br /&gt;
  x-foo {&lt;br /&gt;
      background-color: yellow;&lt;br /&gt;
      border: 1px solid blue;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
[2] The component &amp;quot;wants&amp;quot; to be able to style its outermost rendering rectangle. Because of [http://wiki.whatwg.org/index.php?title=Component_Model_Discussion:_Isolation Isolation], this rectangle is ideally located within the component, i.e., within the shadow DOM.&lt;br /&gt;
&lt;br /&gt;
and as a somewhat lesser concern:&lt;br /&gt;
&lt;br /&gt;
[3] Every point between the rectangles should correspond to a valid DOM range.&lt;br /&gt;
&lt;br /&gt;
ad [3]: Note that conversely, in no variant there is a mapping from a DOM range with anchor &amp;lt;x-foo&amp;gt; to a rectangle/screen position, since the children of &amp;lt;x-foo&amp;gt; may be rendered in arbitrary places, depending on &amp;lt;content&amp;gt; elements within the shadow DOM, or even not at all.&lt;br /&gt;
&lt;br /&gt;
== Rendering ==&lt;br /&gt;
&lt;br /&gt;
This consists of the following, more or less orthogonal, sub-questions&lt;br /&gt;
&lt;br /&gt;
* is the host element rendered or not?&lt;br /&gt;
* is the shadow root rendered or not?&lt;br /&gt;
* is the shadow root an element or a separate node type?&lt;br /&gt;
* using &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
Almost all combinations of the above have their respective merits and problems. Assume we have the following DOM structure:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;A&amp;gt;&lt;br /&gt;
    &amp;lt;x-foo&amp;gt; -----&amp;gt; [ShadowRoot (S)]&lt;br /&gt;
      &amp;lt;B/&amp;gt;            &amp;lt;Y/&amp;gt;&lt;br /&gt;
      &amp;lt;C/&amp;gt;            &amp;lt;Z/&amp;gt;&lt;br /&gt;
      &amp;lt;D/&amp;gt;&lt;br /&gt;
    &amp;lt;/x-foo&amp;gt;&lt;br /&gt;
  &amp;lt;/A&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This could conceivably be rendered in the following ways:&lt;br /&gt;
&lt;br /&gt;
=== [A] rendered host element, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------------------------------------+&lt;br /&gt;
  |       x-foo-------------------------------------------------+       |&lt;br /&gt;
  |       |       SR------------------------------------+       |       |&lt;br /&gt;
  |       |       |       Y------+       Z------+       |       |       |&lt;br /&gt;
  | [A,0] |  ???  | [S,0] |      | [S,1] |      | [S,2] |  ???  | [A,1] |&lt;br /&gt;
  |       |       |       +------+       +------+       |       |       |&lt;br /&gt;
  |       |       +-------------------------------------+       |       |&lt;br /&gt;
  |       +-----------------------------------------------------+       |&lt;br /&gt;
  +---------------------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Styles set on &amp;lt;x-foo&amp;gt; such as &amp;lt;code&amp;gt;background-color&amp;lt;/code&amp;gt; don&#039;t really affect the component&#039;s rendering if the component overrides them on the shadow root.&lt;br /&gt;
* The potential gaps between the shadow root&#039;s rectangle and the outer host element&#039;s rectangle don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [B] rendered host element with default &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;, rendered shadow root, shadow root is element ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  |       :SR------------------------------------+:       |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  | [A,0] :| [S,0] |      | [S,1] |      | [S,2] |: [A,1] |&lt;br /&gt;
  |       :|       Z------+       +------+       |:       |&lt;br /&gt;
  |       :+-------------------------------------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - - - - - - - - - +       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Consequences:&lt;br /&gt;
&lt;br /&gt;
* Shadow root as element requires separate TreeScope tree and host-element pointer&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [A], with the associated issues.&lt;br /&gt;
&lt;br /&gt;
=== [C] rendered host element, rendered shadow root, shadow root is separate node type, shadow root&#039;s rectangle always is the same as the host element&#039;s (no gap) ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------------------------+&lt;br /&gt;
  |       x-foo-----------------------------------+       |&lt;br /&gt;
  |       |SR------------------------------------+|       |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  | [A,0] || [S,0] |      | [S,1] |      | [S,2] || [A,1] |&lt;br /&gt;
  |       ||       Z------+       +------+       ||       |&lt;br /&gt;
  |       |+-------------------------------------+|       |&lt;br /&gt;
  |       +---------------------------------------+       |&lt;br /&gt;
  +-------------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
This allows both the document to style &amp;lt;x-foo&amp;gt;, as well as allowing the component to have its own outer rectangle, but prevents any gap from forming between them. However, this raises more questions than it answers:&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Need to spec how ShadowRoot node type is styleable&lt;br /&gt;
* &amp;lt;code&amp;gt;margin&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;padding&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;position&amp;lt;/code&amp;gt; et al must not apply, so need to define how styles apply to ShadowRoot in detail.&lt;br /&gt;
&lt;br /&gt;
=== [D] rendered host element, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       x-foo---------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] |  ???  |      |  ???  |      |  ???  | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Confinement requires separate style-sheet in order for the component to be able to style the host element.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [E] host element has &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt; by default, shadow root not rendered ===&lt;br /&gt;
&lt;br /&gt;
  A---------------------------------------+&lt;br /&gt;
  |       x-foo - - - - - - - - - +       |&lt;br /&gt;
  |       :Y------+       Z------+:       |&lt;br /&gt;
  |  ???  :|      |  ???  |      |:  ???  |&lt;br /&gt;
  |       :+------+       +------+:       |&lt;br /&gt;
  |       + - - - - - - - - - - - +       |&lt;br /&gt;
  +---------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host, but this is more apparent because of &amp;lt;code&amp;gt;display: transparent&amp;lt;/code&amp;gt;. Containing document could set &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; to something different if needed.&lt;br /&gt;
* If &amp;lt;code&amp;gt;display&amp;lt;/code&amp;gt; is set to something different it becomes variant [D], with the associated issues.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the outer host element don&#039;t directly map to a DOM position. &lt;br /&gt;
&lt;br /&gt;
=== [F] host element not rendered, rendered shadow root ===&lt;br /&gt;
&lt;br /&gt;
In this scenario, the ShadowRoot most likely is an element.&lt;br /&gt;
&lt;br /&gt;
  A-----------------------------------------------------+&lt;br /&gt;
  |       SR------------------------------------+       |&lt;br /&gt;
  |       |       Y------+       Z------+       |       |&lt;br /&gt;
  | [A,0] | [S,0] |      | [S,1] |      | [S,2] | [A,1] |&lt;br /&gt;
  |       |       +------+       +------+       |       |&lt;br /&gt;
  |       +-------------------------------------+       |&lt;br /&gt;
  +-----------------------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* Containing document can&#039;t style the shadow host. Because of Isolation it also can&#039;t style the ShadowRoot, unless styles styles set on &amp;lt;x-foo&amp;gt; are forwarded somehow. If so, mechanism of style forwarding needs to be specced.&lt;br /&gt;
&lt;br /&gt;
=== [G] neither host element nor shadow root rendered ===&lt;br /&gt;
&lt;br /&gt;
  A-------------------------------------+&lt;br /&gt;
  |       Y------+       Z------+       |&lt;br /&gt;
  |  ???  |      |  ???  |      |  ???  |&lt;br /&gt;
  |       +------+       +------+       |&lt;br /&gt;
  +-------------------------------------+&lt;br /&gt;
&lt;br /&gt;
Undoubtedly the most flexible from a layout perspective, as it allows a single element to &amp;quot;create&amp;quot; multiple renderers.&lt;br /&gt;
&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
* There is no single rendering rectangle corresponding to &amp;lt;x-foo&amp;gt;.&lt;br /&gt;
* Containing document can&#039;t style the host element. Styles set on &amp;lt;x-foo&amp;gt; could be forwarded to ALL children of the shadow root, but it&#039;s not clear this is useful.&lt;br /&gt;
* The potential gaps between the rectangles of the shadow root&#039;s children and the host element&#039;s parent don&#039;t directly map to a DOM position.&lt;br /&gt;
&lt;br /&gt;
=== [Z] Other? ===&lt;br /&gt;
&lt;br /&gt;
There is a marvelous variant that solves all issues and doesn&#039;t suffer any of the above drawbacks which this paragraph is too small to contain.&lt;br /&gt;
&lt;br /&gt;
== Current State ==&lt;br /&gt;
&lt;br /&gt;
Currently we implemented variant [D].&lt;/div&gt;</summary>
		<author><name>Rolandsteiner</name></author>
	</entry>
</feed>