This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25139 - [Custom]: Bogus createElement/createElementNS IDL
Summary: [Custom]: Bogus createElement/createElementNS IDL
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dimitri Glazkov
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 14968
  Show dependency treegraph
 
Reported: 2014-03-24 16:56 UTC by Boris Zbarsky
Modified: 2014-05-09 19:44 UTC (History)
4 users (show)

See Also:


Attachments

Description Boris Zbarsky 2014-03-24 16:56:47 UTC
http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-interface-to-instantiate says:

  partial interface Document {
    Element createElement(DOMString localName, optional DOMString typeExtension);
    Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional DOMString typeExtension);
  };

This will fail in a conformant WebIDL implementation, because for example it creates two overloads of createElement:

  [NewObject] Element createElement(DOMString localName);
  Element createElement(DOMString localName, optional DOMString typeExtension);

but WebIDL says:

  If there is more than one entry in an effective overload set that has a given
  type list length, then for those entries there MUST be an index i such that for
  each pair of entries the types at index i are distinguishable.

and in this case the overload set for type list length == 1 has two entries which are identical.

In practice, Gecko instead has this IDL:

 partial interface Document {
   [NewObject]
   Element createElement(DOMString localName, DOMString typeExtension);
   [NewObject]
   Element createElementNS(DOMString? namespace, DOMString qualifiedName, DOMString typeExtension);
 };

(note lack of "optional", which is key); I'm sorry that we didn't provide feedback on this when we implemented something different from the spec.

That said Blink's IDL here is:

    [CustomElementCallbacks, PerWorldBindings, ActivityLogging=ForIsolatedWorlds, RaisesException] Element createElement(DOMString localName, [TreatNullAs=NullString] DOMString typeExtension);

which also has a non-optional typeExtension....
Comment 1 Dimitri Glazkov 2014-05-08 20:42:49 UTC
Make sense. I was originally just monkeypatching createElement, but then turned it into partial, if I recall this correctly.

https://github.com/w3c/webcomponents/pull/10 PTAL?