[Bug 21947] New: [Custom]: Clarify registering HTMLElement.prototype as a prototype multiple times

https://www.w3.org/Bugs/Public/show_bug.cgi?id=21947

            Bug ID: 21947
           Summary: [Custom]: Clarify registering HTMLElement.prototype as
                    a prototype multiple times
    Classification: Unclassified
           Product: WebAppsWG
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Component Model
          Assignee: dglazkov@chromium.org
          Reporter: dominicc@chromium.org
        QA Contact: public-webapps-bugzilla@w3.org
            Blocks: 14968

If the author does this:

document.register('x-foo', {prototype: HTMLElement.prototype})

I think the current spec says implementations should throw a namespace error
per step 5.4 (because HTMLElement does not inherit from HTMLElement.)

However that is really a coincidence; that step is designed to stop you
extending elements outside the SVG and HTML namespaces.

I think defining multiple custom elements with the same prototype object should
be an error (because the constructor property will be updated!) and extending
HTMLElement.prototype directly sucks particularly because it is a widely shared
object.

However if the decision is that a given prototype object can be used for
multiple definitions, I think HTMLElement.prototype should be allowed to be
(ab)used multiple times too.

Perhaps you could make document.register('x-foo', {prototype:
HTMLElement.prototype}) to be sugar for Object.create(HTMLElement.prototype,
{}) just like document.register('x-foo') is. The same could go for using any
built-in interface prototype object directly like this.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.

Received on Tuesday, 7 May 2013 05:29:44 UTC