<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>20485</bug_id>
          
          <creation_ts>2012-12-21 23:54:47 +0000</creation_ts>
          <short_desc>[Custom]: Creation of custom elements via constructor function is underdefined</short_desc>
          <delta_ts>2013-02-08 23:48:22 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Component Model</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>17103</blocked>
    
    <blocked>20684</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Boris Zbarsky">bzbarsky</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>annevk</cc>
    
    <cc>cam</cc>
    
    <cc>ian</cc>
    
    <cc>peterv</cc>
    
    <cc>wchen</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>80512</commentid>
    <comment_count>0</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2012-12-21 23:54:47 +0000</bug_when>
    <thetext>Consider this script:


  var proto = { myProp: 1 };
  proto.__proto__ = HTMLElement.prototype;
  var fun = document.register(&quot;x-foo&quot;, { prototype: obj });
  
  var elem = new fun();
  alert(elem.localName);
  alert(elem.namespaceURI);

as far as I can tell, the specification does not define what those two alerts should show.  It needs to do that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80586</commentid>
    <comment_count>1</comment_count>
    <who name="Peter Van der Beken">peterv</who>
    <bug_when>2012-12-26 11:07:49 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt;   var fun = document.register(&quot;x-foo&quot;, { prototype: obj });

Boris probably meant

   var fun = document.register(&quot;x-foo&quot;, { prototype: proto });</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81587</commentid>
    <comment_count>2</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-18 23:49:15 +0000</bug_when>
    <thetext>I rewrote most of the definitions (Terminology and Instantiating Custom Elements section), so please take a look. Let me know if I messed up.

https://dvcs.w3.org/hg/webcomponents/rev/85c8d5e0f8f9</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81589</commentid>
    <comment_count>3</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-19 00:14:42 +0000</bug_when>
    <thetext>This needs more work. Hold please...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81590</commentid>
    <comment_count>4</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-19 00:28:50 +0000</bug_when>
    <thetext>It&apos;s this freaky territory between WebIDL and DOM core, where things actually live:

1) DOM Core doesn&apos;t want to have anything to do with prototypes. createElement just creates a DOM object (http://dom.spec.whatwg.org/#dom-document-createelement)

2) WebIDL is working with abstract concepts like interfaces, and is a bit coy about the actual relationship between interfaces and interface prototype objects (the JS truth is that the latter defines the former): http://www.w3.org/TR/WebIDL/#interface-prototype-object

I feel like a pioneer! :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81594</commentid>
    <comment_count>5</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-01-19 02:08:31 +0000</bug_when>
    <thetext>The DOM thing is just a bug in the DOM spec, imo.  When you create an object, you need to say what sort of object it is and in particular what its primary interface is.  See http://dev.w3.org/2006/webapi/WebIDL/#dfn-primary-interface

As for WebIDL... The prototype object does not in fact define the interface, really.  Again, an interface is a syntactic concept.  Then in the ES binding an interface may have a corresponding interface object, a corresponding interface prototype object, or both.  The syntactic construct that is the interface then leads to certain properties on those ES objects (e.g. the constants and static attributes/operations go on the interface object, while the non-static operations and attributes go on the interface prototype object).

And yes, you&apos;re a pioneer.  We all are to this business of actually speccing the interaction of the DOM and ES, really.  ;)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81597</commentid>
    <comment_count>6</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-01-19 09:18:46 +0000</bug_when>
    <thetext>I suppose we could create some kind of (namespace, localName) -&gt; interface mapping table. I wonder if it&apos;s best to define a hook for this or just keep the mapping table in DOM as it is in implementations.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81973</commentid>
    <comment_count>7</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-22 21:51:59 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; I suppose we could create some kind of (namespace, localName) -&gt; interface
&gt; mapping table. I wonder if it&apos;s best to define a hook for this or just keep
&gt; the mapping table in DOM as it is in implementations.

Right, I think a hook is what you&apos;re looking for here. HTML can hook into it, and I can hook into it, too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81974</commentid>
    <comment_count>8</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-01-22 22:13:50 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; (In reply to comment #6)
&gt; &gt; I suppose we could create some kind of (namespace, localName) -&gt; interface
&gt; &gt; mapping table. I wonder if it&apos;s best to define a hook for this or just keep
&gt; &gt; the mapping table in DOM as it is in implementations.
&gt; 
&gt; Right, I think a hook is what you&apos;re looking for here. HTML can hook into
&gt; it, and I can hook into it, too.

Here&apos;s the monkeypatch I made: https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#monkeypatch-create-element</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>81976</commentid>
    <comment_count>9</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-01-22 22:18:17 +0000</bug_when>
    <thetext>That&apos;s good text (well, at least much better), but doesn&apos;t actually address _this_ bug, which is about what happens when the return value of register() is called.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>82799</commentid>
    <comment_count>10</comment_count>
    <who name="Dimitri Glazkov">dglazkov</who>
    <bug_when>2013-02-08 23:48:22 +0000</bug_when>
    <thetext>(In reply to comment #9)

This is now done: https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-custom-element-constructor-generation

There&apos;s discussion that will probably trigger more changes in bug 20913.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>