Update defineCustomElement according to the spec rewrite
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Mar 2016 01:23:42 +0000 (01:23 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Mar 2016 01:23:42 +0000 (01:23 +0000)
commitdd1bd50f7df58c5c9a72e2022c11ce57260b43eb
tree0d04014b273a927807165a015e6227ded0669a7c
parent793717dbc2d123804974855a5bb0f2d6569695f3
Update defineCustomElement according to the spec rewrite
https://bugs.webkit.org/show_bug.cgi?id=155010
<rdar://problem/24970878>

Reviewed by Chris Dumez.

Source/WebCore:

Updated the implementation of defineCustomElement and HTMLConstructor per recent rewrite of the spec:
https://w3c.github.io/webcomponents/spec/custom/#dom-document-defineelement
https://w3c.github.io/webcomponents/spec/custom/#htmlelement-constructor

defineCustomElement is now called defineElement and we disallow defining multiple custom elements with
a single class and throw an exception in defineElement.

Test: fast/custom-elements/Document-defineElement.html

* bindings/js/JSDocumentCustom.cpp:
(WebCore::JSDocument::defineElement): Renamed from defineCustomElement. Throw an exception when the interface
already defines another custom element. Also added FIXME's for missing steps.

* bindings/js/JSHTMLElementCustom.cpp:
(WebCore::constructJSHTMLElement): Removed the support for specifying a tag name in the first argument when
a single class defines multiple custom elements since that now results in an exception (in defineElement).

* dom/CustomElementDefinitions.cpp:
(WebCore::CustomElementDefinitions::containsConstructor): Added.
* dom/CustomElementDefinitions.h:
* dom/Document.idl: Renamed defineCustomElement to defineElement.
* html/HTMLElement.idl: Removed the optional tag name from the constructor.

LayoutTests:

Update the tests for the rename and semantics change of defineCustomElement and HTMLElement constructor.

* fast/custom-elements/Document-createElement.html:
* fast/custom-elements/Document-defineCustomElement-expected.txt: Removed.
* fast/custom-elements/Document-defineCustomElement.html: Removed.
* fast/custom-elements/Document-defineElement-expected.txt: Renamed from LayoutTests/fast/custom-elements/Document-defineCustomElement-expected.txt.
* fast/custom-elements/Document-defineElement.html: Renamed from LayoutTests/fast/custom-elements/Document-defineCustomElement.html.
Also added a test case for defining multiple custom elements with a single class, which must throw.
* fast/custom-elements/HTMLElement-constructor-expected.txt:
* fast/custom-elements/HTMLElement-constructor.html:
Removed test cases for the tag name in the first argument as well as ones that associate a single class with multiple tag names.
* fast/custom-elements/parser/parser-constructs-custom-element-in-document-write.html:
* fast/custom-elements/parser/parser-constructs-custom-element-synchronously.html:
* fast/custom-elements/parser/parser-constructs-custom-elements.html:
* fast/custom-elements/parser/parser-fallsback-to-unknown-element.html:
* fast/custom-elements/parser/parser-sets-attributes-and-children.html:
* fast/custom-elements/parser/parser-uses-constructed-element.html:
* fast/custom-elements/parser/parser-uses-registry-of-owner-document.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@197602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/custom-elements/Document-createElement.html
LayoutTests/fast/custom-elements/Document-defineCustomElement-expected.txt [deleted file]
LayoutTests/fast/custom-elements/Document-defineCustomElement.html [deleted file]
LayoutTests/fast/custom-elements/Document-defineElement-expected.txt [new file with mode: 0644]
LayoutTests/fast/custom-elements/Document-defineElement.html [new file with mode: 0644]
LayoutTests/fast/custom-elements/HTMLElement-constructor-expected.txt
LayoutTests/fast/custom-elements/HTMLElement-constructor.html
LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-in-document-write.html
LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-synchronously.html
LayoutTests/fast/custom-elements/parser/parser-constructs-custom-elements.html
LayoutTests/fast/custom-elements/parser/parser-fallsback-to-unknown-element.html
LayoutTests/fast/custom-elements/parser/parser-sets-attributes-and-children.html
LayoutTests/fast/custom-elements/parser/parser-uses-constructed-element.html
LayoutTests/fast/custom-elements/parser/parser-uses-registry-of-owner-document.html
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDocumentCustom.cpp
Source/WebCore/bindings/js/JSHTMLElementCustom.cpp
Source/WebCore/dom/CustomElementDefinitions.cpp
Source/WebCore/dom/CustomElementDefinitions.h
Source/WebCore/dom/Document.idl
Source/WebCore/html/HTMLElement.idl