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 18731 - [Custom]: custom element instantiation does not provide for an initialization method (aka lifecycle.created)
Summary: [Custom]: custom element instantiation does not provide for an initialization...
Status: RESOLVED DUPLICATE of bug 18747
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: 18720
  Show dependency treegraph
 
Reported: 2012-08-29 00:42 UTC by Steve Orvell
Modified: 2012-08-30 21:32 UTC (History)
1 user (show)

See Also:


Attachments

Description Steve Orvell 2012-08-29 00:42:12 UTC
A custom element should be able to do work on its shadow root. The Web Components explainer defines a lifecycle object partly for this purpose (http://dvcs.w3.org/hg/webcomponents/raw-file/tip/explainer/index.html#lifecycle-methods). The lifecycle's created method is called with a reference to the shadow root.

The lifecycle object should likely be included in this spec, and calling the created method should be included in the custom element constructor generation algorithm, where element shadow root is made.

Note that the created method must be called for each shadow root made for the element (see https://www.w3.org/Bugs/Public/show_bug.cgi?id=18729 about how an element can have multiple shadow roots).
Comment 1 Scott Miles 2012-08-29 00:47:56 UTC
At least, it seems a custom element needs an entry point to do set up work. Registrar does not get to supply a constructor, so we need some alternate initializer.

Like Steve says, ultimately this extends to wanting a 'lifecycle' object, as in the WC Explainer.
Comment 2 Dimitri Glazkov 2012-08-29 23:04:30 UTC
Can I just hang "created" it off the Options object? Should the whole lifecycle object be a separate item in the Options?
Comment 3 Scott Miles 2012-08-29 23:11:02 UTC
(In reply to comment #2)
> Can I just hang "created" it off the Options object? Should the whole lifecycle
> object be a separate item in the Options?

I'm inclined to make it a separate object, but my perspective could be questionable. That is to say, I have an interest in keeping alignment with the declarative solution.

Also, the care and feeding of lifecycle is maybe another discussion. Specifically with regard to supporting 'protected' API. One solution for that is to chain 'lifecycle' to the extendee's 'lifecycle', making that object the home for 'protected' methods. Another solution is to have some kind of private key on lifecycle.

In either case, I want to have an object to mess with.
Comment 4 Dimitri Glazkov 2012-08-30 21:32:25 UTC

*** This bug has been marked as a duplicate of bug 18747 ***