[Bug 18729] [Custom]: instantiation algorithm omits creating shadow roots for custom base elements

https://www.w3.org/Bugs/Public/show_bug.cgi?id=18729

--- Comment #7 from Scott Miles <sjmiles@chromium.org> 2012-08-29 20:06:42 UTC ---
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #4)
> > 
> > > Doesn't the generated constructor already have this information? All we need to
> > > do is call it, right?
> > 
> > I am dumb. Ignore me. Let me ponder this.
> 
> Here's what I came up with: we should be able to look up a definition from
> prototype.
> Once we do, we can adjust the constructor generation algorithm to recursively
> look up the prototype and repeat the shadow root instantiation steps.
> 
> Naturally, actual implementations may choose to use other, more performant ways
> to achieve the same thing. WDYT?

"look up a definition from prototype": is non-trivial as I mentioned above, but
we may not have to.

Your previous comment about constructors gave us an idea that we implemented in
polyfill (that will be public as soon as I can make it so), which is to adjust
the instantiate algorithm.

There is a line there that says "Create a new object that implements
PROTOTYPE". There is some wiggle room there.

What we did was: 

1. if PROTOTYPE extends a custom component, call extendee's constructor to
create the new object, otherwise create a new DOM element as the new object
2. set PROTOTYPE as the new object's __proto__

This way, the information stored in the generated constructors is used (that
was your hint).

The only difficulty is determining "if PROTOTYPE extends a custom component"
which could also be framed as "if PROTOTYPE's constructor is a generated
constructor".

We tagged generated constructor's with a flag to solve this problem.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 29 August 2012 20:06:43 UTC