Skip to content

[Custom]: Need to define global/Realm handling for registerElement (bugzilla: 27260) #185

Closed

Description

@hayatoito

Title: [Custom]: Need to define global/Realm handling for registerElement (bugzilla: 27260)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27260


comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27260#c0
Boris Zbarsky wrote on 2014-11-06 17:18:44 +0000.

Created attachment 1535
Testcase

Consider this testcase:

<iframe></iframe> <script> var f = document.registerElement.call(frames[0].document, "x-foo"); </script>

Per the spec, this should "let PROTOTYPE be the result of invoking Object.create with HTMLElement's interface prototype object as only argument". But it doesn't say which "HTMLElement's interface prototype object" should be used.

Then the spec says to run the "custom element constructor generation algorithm", but this algorithm assumes an ambient global, which the spec doesn'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're supposed to be using the registry of the iframe document, so should use its prototypes and constructors.


comment: 1
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=27260#c1
Boris Zbarsky wrote on 2014-11-06 17:26:09 +0000.

Oh, and also, the "definition construction algorithm" is making assumptions about which global'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.

Activity

  1. rniwa commented on Mar 1, 2016

    @rniwa
    Collaborator

    Also see the issue #366 which replaces registerElement with defineElement.

  2. added 5 commits that reference this issue on Mar 1, 2016
    14ff59b
    d275492
    584421a
    dd2188f
    d95392f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions