This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 18842 - [Custom]: Custom element instantiation creates older ShadowRoots for more derived types, which is counterintuitive
Summary: [Custom]: Custom element instantiation creates older ShadowRoots for more der...
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 17103
  Show dependency treegraph
 
Reported: 2012-09-11 23:53 UTC by Dominic Cooney
Modified: 2012-10-24 20:03 UTC (History)
0 users

See Also:


Attachments

Description Dominic Cooney 2012-09-11 23:53:39 UTC
Custom element instantiation processes a custom element’s prototype chain "in reverse order (starting with the most-derived object)".

This means in step 4.4.2, that more derived custom elements create their ShadowRoot first. This has the effect of masking their ShadowRoot with less-derived custom elements, which is counter-intuitive. For example, given:

<element name="x-happy-button" extends="button">
  <template>
      <img src="balloons.gif">
      <content></content>
      <img src="clowns.gif">
  </template>
</element>

<element name="x-super-happy-button" extends="x-happy-button">
  <template>
    <div style="width: 500px; height: 500px; background: teal;">
      <img src="stars.gif">
      <shadow></shadow>
      <img src="puppies.gif">
    </div>
  </template>
</element>

then

<x-super-happy-button>Hello!</x-super-happy-button>

will not be big, teal, nor have stars nor puppies, because the super happy ShadowRoot content will have been preempted by the younger, merely happy ShadowRoot which was instantiated later.
Comment 1 Dimitri Glazkov 2012-10-24 20:03:12 UTC
http://dvcs.w3.org/hg/webcomponents/rev/632c44aed726

Sorry, I misunderstood the meaning of "most-derived" to mean the opposite :)