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 24019 - [Custom]: No way to associate class/constructor function
Summary: [Custom]: No way to associate class/constructor function
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14968
  Show dependency treegraph
 
Reported: 2013-12-06 15:44 UTC by Erik Arvidsson
Modified: 2014-05-12 18:29 UTC (History)
1 user (show)

See Also:


Attachments

Description Erik Arvidsson 2013-12-06 15:44:03 UTC
If I use a function as the argument to document.register, its @@create method is not called when an instance is created.

class MyElement extends HTMLElement {
  [Symbol.create]() {
    console.log("never called :'(");
    super();
  }
}
MyElement = document.register('my-element', MyElement)
new MyElement;
Comment 1 Dominic Cooney 2013-12-08 00:25:37 UTC
I think this should be addressed in Level 2 of the Custom Elements spec, or in a related spec. Chrome is not in a position to implement this now.

I believe the spec needs to explain when @@create should be called. As a first cut, I believe the UA should have latitude as to when to call it. The requirement should be something like @@create MUST be called as the first step of upgrade.

Would this result in intolerable weirdness when doing post-hoc upgrade of an existing element?
Comment 2 Dimitri Glazkov 2014-05-12 18:29:52 UTC
https://github.com/w3c/webcomponents/pull/12