RESOLVED FIXED 155010
Update defineCustomElement according to the spec rewrite
https://bugs.webkit.org/show_bug.cgi?id=155010
Summary Update defineCustomElement according to the spec rewrite
Ryosuke Niwa
Reported 2016-03-03 22:36:07 PST
Rename document.defineCustomElement to document.defineElement and disallow a single class from defining multiple custom elements. Also remove the optional first argument from the HTMLElement constructor.
Attachments
Fixes the bug (51.59 KB, patch)
2016-03-03 22:53 PST, Ryosuke Niwa
cdumez: review+
Radar WebKit Bug Importer
Comment 1 2016-03-03 22:37:02 PST
Ryosuke Niwa
Comment 2 2016-03-03 22:53:42 PST
Created attachment 272835 [details] Fixes the bug
Chris Dumez
Comment 3 2016-03-04 15:45:44 PST
Comment on attachment 272835 [details] Fixes the bug View in context: https://bugs.webkit.org/attachment.cgi?id=272835&action=review r=me with questions > Source/WebCore/dom/CustomElementDefinitions.h:55 > + bool containsInterface(const JSC::JSObject*) const; Would naming this "containsConstructor" make more sense? > Source/WebCore/dom/Document.idl:298 > + void defineElement(DOMString tagName, CustomElementInterface elementInterface); The spec has: void defineElement(DOMString type, Function constructor, optional ElementRegistrationOptions options); Why the mismatch?
Ryosuke Niwa
Comment 4 2016-03-04 17:15:08 PST
Comment on attachment 272835 [details] Fixes the bug View in context: https://bugs.webkit.org/attachment.cgi?id=272835&action=review Thanks for the review! >> Source/WebCore/dom/CustomElementDefinitions.h:55 >> + bool containsInterface(const JSC::JSObject*) const; > > Would naming this "containsConstructor" make more sense? Renamed. >> Source/WebCore/dom/Document.idl:298 >> + void defineElement(DOMString tagName, CustomElementInterface elementInterface); > > The spec has: > void defineElement(DOMString type, Function constructor, optional ElementRegistrationOptions options); > > Why the mismatch? Changed it to: void defineElement(DOMString localName, Function constructor); since we don't support the optional options argument which is used to subclass subclasses of HTMLElement; e.g. HTMLInputElement. I've also filed a Github issue to rename the first argument to localName: https://github.com/w3c/webcomponents/issues/416 since type is too generic name and doesn't match the argument name of createElement.
Ryosuke Niwa
Comment 5 2016-03-04 17:23:31 PST
Note You need to log in before you can comment on or make changes to this bug.