<?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>27260</bug_id>
          
          <creation_ts>2014-11-06 17:18:44 +0000</creation_ts>
          <short_desc>[Custom]: Need to define global/Realm handling for registerElement</short_desc>
          <delta_ts>2015-07-06 08:13:35 +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>MOVED</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>14968</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Boris Zbarsky">bzbarsky</reporter>
          <assigned_to name="Dimitri Glazkov">dglazkov</assigned_to>
          <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>114609</commentid>
    <comment_count>0</comment_count>
      <attachid>1535</attachid>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-11-06 17:18:44 +0000</bug_when>
    <thetext>Created attachment 1535
Testcase

Consider this testcase:

  &lt;iframe&gt;&lt;/iframe&gt;
  &lt;script&gt;
    var f = document.registerElement.call(frames[0].document, &quot;x-foo&quot;);
  &lt;/script&gt;

Per the spec, this should &quot;let PROTOTYPE be the result of invoking Object.create with HTMLElement&apos;s interface prototype object as only argument&quot;.  But it doesn&apos;t say _which_ &quot;HTMLElement&apos;s interface prototype object&quot; should be used.

Then the spec says to run the &quot;custom element constructor generation algorithm&quot;, but this algorithm assumes an ambient global, which the spec doesn&apos;t define.

In practice, the Chrome and Firefox implementations differ, as the attached testcase shows.  The output in Chrome:

  ctor instanceof iframe Function: false
  ctor instanceof parent Function: true
  proto comes from iframe: false
  proto comes from parent: true

The output in Firefox:

  ctor instanceof iframe Function: true
  ctor instanceof parent Function: false
  proto comes from iframe: true
  proto comes from parent: false

I believe the Firefox behavior is more correct here, by the way, since we&apos;re supposed to be using the registry of the iframe document, so should use its prototypes and constructors.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114610</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-11-06 17:26:09 +0000</bug_when>
    <thetext>Oh, and also, the &quot;definition construction algorithm&quot; is making assumptions about which global&apos;s prototypes or interfaces are supposed to be used.  This part is also not interoperable in Chrome and Firefox: Firefox seems to require that the passed-in proto come from the same global as the document involved, as you can see in the testcase.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121718</commentid>
    <comment_count>2</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2015-07-06 08:13:35 +0000</bug_when>
    <thetext>Moved to https://github.com/w3c/webcomponents/issues/185</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1535</attachid>
            <date>2014-11-06 17:18:44 +0000</date>
            <delta_ts>2014-11-06 17:18:44 +0000</delta_ts>
            <desc>Testcase</desc>
            <filename>baz.html</filename>
            <type>text/html</type>
            <size>1169</size>
            <attacher name="Boris Zbarsky">bzbarsky</attacher>
            
              <data encoding="base64">PGlmcmFtZT48L2lmcmFtZT4KPHByZT48c2NyaXB0PgogIHZhciBmID0gZG9jdW1lbnQucmVnaXN0
ZXJFbGVtZW50LmNhbGwoZnJhbWVzWzBdLmRvY3VtZ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