- From: Dominic Cooney <dominicc@google.com>
- Date: Fri, 26 Aug 2011 07:25:13 -0700
- To: Roland Steiner <rolandsteiner@google.com>
- Cc: WebApps WG <public-webapps@w3.org>, Dimitri Glazkov <dglazkov@google.com>, Hajime Morita <morrita@google.com>
I think HTMLElement.call should throw if there’s not an associated tag name. However exactly how that association happens, I am not sure. JavaScript can’t rely on the 'constructor' property. Shadowing the tagName attribute on the prototype is not ideal, because it may be mutable and it would be confusing if it was mutated. Alternatively we could require subtypes of some specific tag, like HTMLDivElement, and use that tag name if there's no registered tag name. That means the UA can't limit special casing to x- elements, although I think that is OK. Dominic On Fri, Aug 26, 2011 at 1:16 AM, Roland Steiner <rolandsteiner@google.com> wrote: > From the discussion about "x-" prefixed names another question crossed my > mind: Suppose an author defines a component, but doesn't register a tag > name. AFAICT, at this point nothing prevents him from inserting such a new > element into the DOM. E.g.: > <div id="div"></div> > <script> > function MyNewElement() { > HTMLElement.call(this); > // ... > } > var div = document.getElementById("div"); > div.appendChild(new MyNewElement()); > > // ... Look Ma, no Element.register() call! > > var text = div.innerHTML; // <- what does this return? > </script> > > Cheers, > - Roland
Received on Friday, 26 August 2011 14:25:39 UTC