From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../tests/custom-elements/reactions/Animation.html | 66 +++ .../reactions/AriaMixin-element-attributes.html | 65 +++ .../reactions/AriaMixin-string-attributes.html | 66 +++ .../tests/custom-elements/reactions/Attr.html | 23 ++ .../reactions/CSSStyleDeclaration.html | 89 ++++ .../tests/custom-elements/reactions/ChildNode.html | 35 ++ .../custom-elements/reactions/DOMStringMap.html | 96 +++++ .../custom-elements/reactions/DOMTokenList.html | 210 ++++++++++ .../tests/custom-elements/reactions/Document.html | 156 +++++++ .../tests/custom-elements/reactions/Element.html | 91 +++++ .../reactions/ElementContentEditable.html | 21 + .../reactions/HTMLAnchorElement.html | 32 ++ .../custom-elements/reactions/HTMLElement.html | 37 ++ .../reactions/HTMLOptionElement.html | 35 ++ .../reactions/HTMLOptionsCollection.html | 122 ++++++ .../reactions/HTMLOutputElement.html | 45 ++ .../reactions/HTMLSelectElement.html | 122 ++++++ .../reactions/HTMLTableElement.html | 173 ++++++++ .../reactions/HTMLTableRowElement.html | 34 ++ .../reactions/HTMLTableSectionElement.html | 45 ++ .../reactions/HTMLTitleElement.html | 35 ++ .../custom-elements/reactions/NamedNodeMap.html | 39 ++ .../tests/custom-elements/reactions/Node.html | 49 +++ .../custom-elements/reactions/ParentNode.html | 27 ++ .../tests/custom-elements/reactions/Range.html | 54 +++ .../tests/custom-elements/reactions/Selection.html | 32 ++ .../custom-elements/reactions/ShadowRoot.html | 52 +++ .../customized-builtins/HTMLAreaElement.html | 69 ++++ .../customized-builtins/HTMLBaseElement.html | 21 + .../customized-builtins/HTMLButtonElement.html | 80 ++++ .../customized-builtins/HTMLCanvasElement.html | 16 + .../customized-builtins/HTMLDataElement.html | 15 + .../customized-builtins/HTMLDetailsElement.html | 15 + .../customized-builtins/HTMLEmbedElement.html | 35 ++ .../customized-builtins/HTMLFieldSetElement.html | 32 ++ .../customized-builtins/HTMLImageElement.html | 89 ++++ .../customized-builtins/HTMLInputElement.html | 66 +++ .../customized-builtins/HTMLLIElement.html | 38 ++ .../customized-builtins/HTMLLabelElement.html | 29 ++ .../customized-builtins/HTMLMapElement.html | 17 + .../customized-builtins/HTMLMediaElement.html | 107 +++++ .../customized-builtins/HTMLMetaElement.html | 77 ++++ .../customized-builtins/HTMLMeterElement.html | 55 +++ .../customized-builtins/HTMLModElement.html | 18 + .../customized-builtins/HTMLOListElement.html | 17 + .../customized-builtins/HTMLOptGroupElement.html | 38 ++ .../customized-builtins/HTMLParamElement.html | 41 ++ .../customized-builtins/HTMLProgressElement.html | 25 ++ .../customized-builtins/HTMLQuoteElement.html | 16 + .../customized-builtins/HTMLSlotElement.html | 15 + .../customized-builtins/HTMLSourceElement.html | 191 +++++++++ .../customized-builtins/HTMLStyleElement.html | 23 ++ .../customized-builtins/HTMLTableCellElement.html | 63 +++ .../customized-builtins/HTMLTableColElement.html | 25 ++ .../customized-builtins/HTMLTimeElement.html | 15 + .../reactions/resources/reactions.js | 452 +++++++++++++++++++++ .../custom-elements/reactions/with-exceptions.html | 35 ++ 57 files changed, 3586 insertions(+) create mode 100644 testing/web-platform/tests/custom-elements/reactions/Animation.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/AriaMixin-element-attributes.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/AriaMixin-string-attributes.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/Attr.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/CSSStyleDeclaration.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/ChildNode.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/DOMStringMap.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/DOMTokenList.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/Document.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/Element.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/ElementContentEditable.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLAnchorElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLOptionElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLOptionsCollection.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLOutputElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLSelectElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLTableElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLTableRowElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLTableSectionElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/HTMLTitleElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/NamedNodeMap.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/Node.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/ParentNode.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/Range.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/Selection.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/ShadowRoot.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLAreaElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLBaseElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLButtonElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLCanvasElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLDataElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLDetailsElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLEmbedElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLFieldSetElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLImageElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLInputElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLLIElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLLabelElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMapElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMediaElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMetaElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMeterElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLModElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLOListElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLOptGroupElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLParamElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLProgressElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLQuoteElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLSlotElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLSourceElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLStyleElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTableCellElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTableColElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTimeElement.html create mode 100644 testing/web-platform/tests/custom-elements/reactions/resources/reactions.js create mode 100644 testing/web-platform/tests/custom-elements/reactions/with-exceptions.html (limited to 'testing/web-platform/tests/custom-elements/reactions') diff --git a/testing/web-platform/tests/custom-elements/reactions/Animation.html b/testing/web-platform/tests/custom-elements/reactions/Animation.html new file mode 100644 index 0000000000..47eff97497 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/Animation.html @@ -0,0 +1,66 @@ + + + +Custom Elements: CEReactions on Element interface + + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/AriaMixin-element-attributes.html b/testing/web-platform/tests/custom-elements/reactions/AriaMixin-element-attributes.html new file mode 100644 index 0000000000..09e62b2d39 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/AriaMixin-element-attributes.html @@ -0,0 +1,65 @@ + + + +Custom Elements: CEReactions on Element interface + + + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/AriaMixin-string-attributes.html b/testing/web-platform/tests/custom-elements/reactions/AriaMixin-string-attributes.html new file mode 100644 index 0000000000..f71bf2daa9 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/AriaMixin-string-attributes.html @@ -0,0 +1,66 @@ + + + +Custom Elements: CEReactions on Element interface + + + + + + + + + + +
+
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/Attr.html b/testing/web-platform/tests/custom-elements/reactions/Attr.html new file mode 100644 index 0000000000..c9fa37f961 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/Attr.html @@ -0,0 +1,23 @@ + + + +Custom Elements: CEReactions on Attr interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/CSSStyleDeclaration.html b/testing/web-platform/tests/custom-elements/reactions/CSSStyleDeclaration.html new file mode 100644 index 0000000000..95274d8c75 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/CSSStyleDeclaration.html @@ -0,0 +1,89 @@ + + + +Custom Elements: CEReactions on CSSStyleDeclaration interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/ChildNode.html b/testing/web-platform/tests/custom-elements/reactions/ChildNode.html new file mode 100644 index 0000000000..f808b67a80 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/ChildNode.html @@ -0,0 +1,35 @@ + + + +Custom Elements: CEReactions on ChildNode interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/DOMStringMap.html b/testing/web-platform/tests/custom-elements/reactions/DOMStringMap.html new file mode 100644 index 0000000000..5e34dfe2ba --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/DOMStringMap.html @@ -0,0 +1,96 @@ + + + +Custom Elements: CEReactions on DOMStringMap interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/DOMTokenList.html b/testing/web-platform/tests/custom-elements/reactions/DOMTokenList.html new file mode 100644 index 0000000000..14a643c4a8 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/DOMTokenList.html @@ -0,0 +1,210 @@ + + + +Custom Elements: CEReactions on DOMTokenList interface + + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/Document.html b/testing/web-platform/tests/custom-elements/reactions/Document.html new file mode 100644 index 0000000000..1f05982a90 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/Document.html @@ -0,0 +1,156 @@ + + + +Custom Elements: CEReactions on Document interface + + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/Element.html b/testing/web-platform/tests/custom-elements/reactions/Element.html new file mode 100644 index 0000000000..e1576734d0 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/Element.html @@ -0,0 +1,91 @@ + + + +Custom Elements: CEReactions on Element interface + + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/ElementContentEditable.html b/testing/web-platform/tests/custom-elements/reactions/ElementContentEditable.html new file mode 100644 index 0000000000..bdb10761cb --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/ElementContentEditable.html @@ -0,0 +1,21 @@ + + + +Custom Elements: CEReactions on ElementContentEditable interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLAnchorElement.html b/testing/web-platform/tests/custom-elements/reactions/HTMLAnchorElement.html new file mode 100644 index 0000000000..c6eeb1dce9 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLAnchorElement.html @@ -0,0 +1,32 @@ + + + +Custom Elements: CEReactions on HTMLAnchorElement interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLElement.html b/testing/web-platform/tests/custom-elements/reactions/HTMLElement.html new file mode 100644 index 0000000000..bd25228216 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLElement.html @@ -0,0 +1,37 @@ + + + +Custom Elements: CEReactions on HTMLElement interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLOptionElement.html b/testing/web-platform/tests/custom-elements/reactions/HTMLOptionElement.html new file mode 100644 index 0000000000..418ef282b3 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLOptionElement.html @@ -0,0 +1,35 @@ + + + +Custom Elements: CEReactions on HTMLOptionElement interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLOptionsCollection.html b/testing/web-platform/tests/custom-elements/reactions/HTMLOptionsCollection.html new file mode 100644 index 0000000000..0d64259d06 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLOptionsCollection.html @@ -0,0 +1,122 @@ + + + +Custom Elements: CEReactions on HTMLOptionsCollection interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLOutputElement.html b/testing/web-platform/tests/custom-elements/reactions/HTMLOutputElement.html new file mode 100644 index 0000000000..02e669bc7a --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLOutputElement.html @@ -0,0 +1,45 @@ + + + +Custom Elements: CEReactions on HTMLOutputElement interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLSelectElement.html b/testing/web-platform/tests/custom-elements/reactions/HTMLSelectElement.html new file mode 100644 index 0000000000..7c79634f66 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLSelectElement.html @@ -0,0 +1,122 @@ + + + +Custom Elements: CEReactions on HTMLSelectElement interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLTableElement.html b/testing/web-platform/tests/custom-elements/reactions/HTMLTableElement.html new file mode 100644 index 0000000000..6adf2623d6 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLTableElement.html @@ -0,0 +1,173 @@ + + + +Custom Elements: CEReactions on HTMLTableElement interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLTableRowElement.html b/testing/web-platform/tests/custom-elements/reactions/HTMLTableRowElement.html new file mode 100644 index 0000000000..a9a00a5da3 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLTableRowElement.html @@ -0,0 +1,34 @@ + + + +Custom Elements: CEReactions on HTMLTableRowElement interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLTableSectionElement.html b/testing/web-platform/tests/custom-elements/reactions/HTMLTableSectionElement.html new file mode 100644 index 0000000000..cbb0a146e8 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLTableSectionElement.html @@ -0,0 +1,45 @@ + + + +Custom Elements: CEReactions on HTMLTableSectionElement interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/HTMLTitleElement.html b/testing/web-platform/tests/custom-elements/reactions/HTMLTitleElement.html new file mode 100644 index 0000000000..6678944c91 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/HTMLTitleElement.html @@ -0,0 +1,35 @@ + + + +Custom Elements: CEReactions on HTMLTitleElement interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/NamedNodeMap.html b/testing/web-platform/tests/custom-elements/reactions/NamedNodeMap.html new file mode 100644 index 0000000000..fa21b3ada9 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/NamedNodeMap.html @@ -0,0 +1,39 @@ + + + +Custom Elements: CEReactions on NamedNodeMap interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/Node.html b/testing/web-platform/tests/custom-elements/reactions/Node.html new file mode 100644 index 0000000000..94da3d020e --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/Node.html @@ -0,0 +1,49 @@ + + + +Custom Elements: CEReactions on Node interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/ParentNode.html b/testing/web-platform/tests/custom-elements/reactions/ParentNode.html new file mode 100644 index 0000000000..b143b5a982 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/ParentNode.html @@ -0,0 +1,27 @@ + + + +Custom Elements: CEReactions on ParentNode interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/Range.html b/testing/web-platform/tests/custom-elements/reactions/Range.html new file mode 100644 index 0000000000..c4a8252ff6 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/Range.html @@ -0,0 +1,54 @@ + + + +Custom Elements: CEReactions on Range interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/Selection.html b/testing/web-platform/tests/custom-elements/reactions/Selection.html new file mode 100644 index 0000000000..84214201aa --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/Selection.html @@ -0,0 +1,32 @@ + + + +Custom Elements: CEReactions on Selection interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/ShadowRoot.html b/testing/web-platform/tests/custom-elements/reactions/ShadowRoot.html new file mode 100644 index 0000000000..9997d9c836 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/ShadowRoot.html @@ -0,0 +1,52 @@ + + + +Custom Elements: CEReactions on ShadowRoot interface + + + + + + + + + +
+ + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLAreaElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLAreaElement.html new file mode 100644 index 0000000000..3d53ff87ff --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLAreaElement.html @@ -0,0 +1,69 @@ + +Custom Elements: CEReactions on HTMLAreaElement interface + + + + + + + + + + +yellow pic + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLBaseElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLBaseElement.html new file mode 100644 index 0000000000..8d8470074c --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLBaseElement.html @@ -0,0 +1,21 @@ + + +Custom Elements: CEReactions on HTMLBaseElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLButtonElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLButtonElement.html new file mode 100644 index 0000000000..62f8b7b0c9 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLButtonElement.html @@ -0,0 +1,80 @@ + +Custom Elements: CEReactions on HTMLButtonElement interface + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLCanvasElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLCanvasElement.html new file mode 100644 index 0000000000..6c7119252e --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLCanvasElement.html @@ -0,0 +1,16 @@ + +Custom Elements: CEReactions on HTMLCanvasElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLDataElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLDataElement.html new file mode 100644 index 0000000000..f078c6aa02 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLDataElement.html @@ -0,0 +1,15 @@ + +Custom Elements: CEReactions on HTMLDataElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLDetailsElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLDetailsElement.html new file mode 100644 index 0000000000..4d81e3e627 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLDetailsElement.html @@ -0,0 +1,15 @@ + +Custom Elements: CEReactions on HTMLDetailsElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLEmbedElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLEmbedElement.html new file mode 100644 index 0000000000..923bde7583 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLEmbedElement.html @@ -0,0 +1,35 @@ + +Custom Elements: CEReactions on HTMLEmbedElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLFieldSetElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLFieldSetElement.html new file mode 100644 index 0000000000..517523551b --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLFieldSetElement.html @@ -0,0 +1,32 @@ + +Custom Elements: CEReactions on HTMLFieldSetElement interface + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLImageElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLImageElement.html new file mode 100644 index 0000000000..656e29eb17 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLImageElement.html @@ -0,0 +1,89 @@ + +Custom Elements: CEReactions on HTMLImageElement interface + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLInputElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLInputElement.html new file mode 100644 index 0000000000..adf43ee74d --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLInputElement.html @@ -0,0 +1,66 @@ + + +Custom Elements: CEReactions on HTMLInputElement interface + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLLIElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLLIElement.html new file mode 100644 index 0000000000..adba2addf6 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLLIElement.html @@ -0,0 +1,38 @@ + +Custom Elements: CEReactions on HTMLLIElement interface + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLLabelElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLLabelElement.html new file mode 100644 index 0000000000..2fe2741dad --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLLabelElement.html @@ -0,0 +1,29 @@ + +Custom Elements: CEReactions on HTMLLabelElement interface + + + + + + + + +
+ + +
+ diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMapElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMapElement.html new file mode 100644 index 0000000000..5b2e674afb --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMapElement.html @@ -0,0 +1,17 @@ + +Custom Elements: CEReactions on HTMLMapElement interface + + + + + + + + +yellow pic +green pic + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMediaElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMediaElement.html new file mode 100644 index 0000000000..58e002c52c --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMediaElement.html @@ -0,0 +1,107 @@ + +Custom Elements: CEReactions on HTMLMediaElement interface + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMetaElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMetaElement.html new file mode 100644 index 0000000000..b6e8c06546 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMetaElement.html @@ -0,0 +1,77 @@ + +Custom Elements: CEReactions on HTMLMetaElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMeterElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMeterElement.html new file mode 100644 index 0000000000..707e56c605 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLMeterElement.html @@ -0,0 +1,55 @@ + +Custom Elements: CEReactions on HTMLMeterElement interface + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLModElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLModElement.html new file mode 100644 index 0000000000..850fe170a5 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLModElement.html @@ -0,0 +1,18 @@ + +Custom Elements: CEReactions on HTMLModElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLOListElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLOListElement.html new file mode 100644 index 0000000000..b62f31b489 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLOListElement.html @@ -0,0 +1,17 @@ + +Custom Elements: CEReactions on HTMLOListElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLOptGroupElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLOptGroupElement.html new file mode 100644 index 0000000000..afa31bb465 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLOptGroupElement.html @@ -0,0 +1,38 @@ + +Custom Elements: CEReactions on HTMLOptGroupElement interface + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLParamElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLParamElement.html new file mode 100644 index 0000000000..eb3a13962f --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLParamElement.html @@ -0,0 +1,41 @@ + +Custom Elements: CEReactions on HTMLParamElement interface + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLProgressElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLProgressElement.html new file mode 100644 index 0000000000..42683f4ede --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLProgressElement.html @@ -0,0 +1,25 @@ + +Custom Elements: CEReactions on HTMLProgressElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLQuoteElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLQuoteElement.html new file mode 100644 index 0000000000..f9c3d7538c --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLQuoteElement.html @@ -0,0 +1,16 @@ + +Custom Elements: CEReactions on HTMLQuoteElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLSlotElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLSlotElement.html new file mode 100644 index 0000000000..56871873b4 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLSlotElement.html @@ -0,0 +1,15 @@ + +Custom Elements: CEReactions on HTMLSlotElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLSourceElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLSourceElement.html new file mode 100644 index 0000000000..f7d567ebcb --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLSourceElement.html @@ -0,0 +1,191 @@ + +Custom Elements: CEReactions on HTMLSourceElement interface + + + + + + + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLStyleElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLStyleElement.html new file mode 100644 index 0000000000..d68d5cb76d --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLStyleElement.html @@ -0,0 +1,23 @@ + +Custom Elements: CEReactions on HTMLStyleElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTableCellElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTableCellElement.html new file mode 100644 index 0000000000..95a8459df8 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTableCellElement.html @@ -0,0 +1,63 @@ + +Custom Elements: CEReactions on HTMLTableCellElement interface + + + + + + + + +
+
+
+ diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTableColElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTableColElement.html new file mode 100644 index 0000000000..8e4d1359d8 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTableColElement.html @@ -0,0 +1,25 @@ + +Custom Elements: CEReactions on HTMLTableColElement interface + + + + + + + + +
+ diff --git a/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTimeElement.html b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTimeElement.html new file mode 100644 index 0000000000..b2f4cc8af7 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/customized-builtins/HTMLTimeElement.html @@ -0,0 +1,15 @@ + +Custom Elements: CEReactions on HTMLTimeElement interface + + + + + + + + + diff --git a/testing/web-platform/tests/custom-elements/reactions/resources/reactions.js b/testing/web-platform/tests/custom-elements/reactions/resources/reactions.js new file mode 100644 index 0000000000..5ed32a4fa4 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/resources/reactions.js @@ -0,0 +1,452 @@ + +let testNumber = 1; + +function testNodeConnector(testFunction, name) { + let container = document.createElement('div'); + container.appendChild(document.createElement('div')); + document.body.appendChild(container); + + test(function () { + var element = define_new_custom_element(); + var instance = document.createElement(element.name); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(container, instance); + assert_array_equals(element.takeLog().types(), ['connected']); + }, name + ' must enqueue a connected reaction'); + + test(function () { + var element = define_new_custom_element(); + var instance = document.createElement(element.name); + assert_array_equals(element.takeLog().types(), ['constructed']); + var newDoc = document.implementation.createHTMLDocument(); + testFunction(container, instance); + assert_array_equals(element.takeLog().types(), ['connected']); + testFunction(newDoc.documentElement, instance); + assert_array_equals(element.takeLog().types(), ['disconnected', 'adopted', 'connected']); + }, name + ' must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document'); + + container.parentNode.removeChild(container); +} + +function testNodeDisconnector(testFunction, name) { + let container = document.createElement('div'); + container.appendChild(document.createElement('div')); + document.body.appendChild(container); + + test(function () { + var element = define_new_custom_element(); + var instance = document.createElement(element.name); + assert_array_equals(element.takeLog().types(), ['constructed']); + container.appendChild(instance); + assert_array_equals(element.takeLog().types(), ['connected']); + testFunction(instance, window); + assert_array_equals(element.takeLog().types(), ['disconnected']); + }, name + ' must enqueue a disconnected reaction'); + + container.parentNode.removeChild(container); +} + +function testInsertingMarkup(testFunction, name) { + let container = document.createElement('div'); + container.appendChild(document.createElement('div')); + document.body.appendChild(container); + + test(function () { + var element = define_new_custom_element(); + testFunction(container, `<${element.name}>`); + assert_array_equals(element.takeLog().types(), ['constructed', 'connected']); + }, name + ' must enqueue a connected reaction for a newly constructed custom element'); + + test(function () { + var element = define_new_custom_element(['title']); + testFunction(container, `<${element.name} id="hello" title="hi">`); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged', 'connected']); + assert_attribute_log_entry(logEntries[1], {name: 'title', oldValue: null, newValue: 'hi', namespace: null}); + }, name + ' must enqueue a attributeChanged reaction for a newly constructed custom element'); + + container.parentNode.removeChild(container); +} + +function testParsingMarkup(testFunction, name) { + test(function () { + var element = define_new_custom_element(['id']); + assert_array_equals(element.takeLog().types(), []); + var instance = testFunction(document, `<${element.name} id="hello" class="foo">`); + assert_equals(Object.getPrototypeOf(instance.querySelector(element.name)), element.class.prototype); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged']); + assert_attribute_log_entry(logEntries[1], {name: 'id', oldValue: null, newValue: 'hello', namespace: null}); + }, name + ' must construct a custom element'); +} + +function testCloner(testFunction, name) { + let container = document.createElement('div'); + container.appendChild(document.createElement('div')); + document.body.appendChild(container); + + test(function () { + var element = define_new_custom_element(['id']); + var instance = document.createElement(element.name); + container.appendChild(instance); + + instance.setAttribute('id', 'foo'); + assert_array_equals(element.takeLog().types(), ['constructed', 'connected', 'attributeChanged']); + var newInstance = testFunction(instance); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: 'id', oldValue: null, newValue: 'foo', namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when cloning an element with an observed attribute'); + + test(function () { + var element = define_new_custom_element(['id']); + var instance = document.createElement(element.name); + container.appendChild(instance); + + instance.setAttribute('lang', 'en'); + assert_array_equals(element.takeLog().types(), ['constructed', 'connected']); + var newInstance = testFunction(instance); + assert_array_equals(element.takeLog().types(), ['constructed']); + }, name + ' must not enqueue an attributeChanged reaction when cloning an element with an unobserved attribute'); + + test(function () { + var element = define_new_custom_element(['title', 'class']); + var instance = document.createElement(element.name); + container.appendChild(instance); + + instance.setAttribute('lang', 'en'); + instance.className = 'foo'; + instance.setAttribute('title', 'hello world'); + assert_array_equals(element.takeLog().types(), ['constructed', 'connected', 'attributeChanged', 'attributeChanged']); + var newInstance = testFunction(instance); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged', 'attributeChanged']); + assert_attribute_log_entry(logEntries[1], {name: 'class', oldValue: null, newValue: 'foo', namespace: null}); + assert_attribute_log_entry(logEntries[2], {name: 'title', oldValue: null, newValue: 'hello world', namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when cloning an element only for observed attributes'); +} + +function testReflectAttributeWithContentValues(jsAttributeName, contentAttributeName, validValue1, contentValue1, validValue2, contentValue2, name, elementName, interfaceName) { + test(function () { + if (elementName === undefined) { + var element = define_new_custom_element([contentAttributeName]); + var instance = document.createElement(element.name); + } else { + var element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName); + var instance = document.createElement(elementName, { is: element.name }); + } + assert_array_equals(element.takeLog().types(), ['constructed']); + instance[jsAttributeName] = validValue1; + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + + assert_attribute_log_entry(logEntries.last(), {name: contentAttributeName, oldValue: null, newValue: contentValue1, namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when adding ' + contentAttributeName + ' content attribute'); + + test(function () { + if (elementName === undefined) { + var element = define_new_custom_element([contentAttributeName]); + var instance = document.createElement(element.name); + } else { + var element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName); + var instance = document.createElement(elementName, { is: element.name }); + } + instance[jsAttributeName] = validValue1; + assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']); + instance[jsAttributeName] = validValue2; + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: contentAttributeName, oldValue: contentValue1, newValue: contentValue2, namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute'); +} + +function testReflectAttribute(jsAttributeName, contentAttributeName, validValue1, validValue2, name, elementName, interfaceName) { + testReflectAttributeWithContentValues(jsAttributeName, contentAttributeName, validValue1, validValue1, validValue2, validValue2, name, elementName, interfaceName); +} + +function testReflectBooleanAttribute(jsAttributeName, contentAttributeName, name, elementName, interfaceName) { + testReflectAttributeWithContentValues(jsAttributeName, contentAttributeName, true, '', false, null, name, elementName, interfaceName); +} + +function testReflectAttributeWithContentValuesAndDependentAttributes(jsAttributeName, contentAttributeName, validValue1, contentValue1, validValue2, contentValue2, name, elementName, getParentElement, setAttributes, interfaceName) { + let parentElement = getParentElement(); + + test(() => { + let element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName); + let instance = document.createElement(elementName, { is: element.name }); + + assert_array_equals(element.takeLog().types(), ['constructed']); + parentElement.appendChild(instance); + assert_array_equals(element.takeLog().types(), ['connected']); + setAttributes(instance); + instance[jsAttributeName] = validValue1; + let logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), { name: contentAttributeName, oldValue: null, newValue: contentValue1, namespace: null }); + + }, name + ' must enqueue an attributeChanged reaction when adding a new attribute'); + + test(() => { + let element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName); + let instance = document.createElement(elementName, { is: element.name }); + parentElement.appendChild(instance); + setAttributes(instance); + instance[jsAttributeName] = validValue1; + + assert_array_equals(element.takeLog().types(), ['constructed', 'connected', 'attributeChanged']); + instance[jsAttributeName] = validValue2; + let logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), { name: contentAttributeName, oldValue: contentValue1, newValue: contentValue2, namespace: null }); + + }, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute'); +} + +function testReflectAttributeWithDependentAttributes(jsAttributeName, contentAttributeName, validValue1, validValue2, name, elementName, getParentElement, setAttributes, interfaceName) { + testReflectAttributeWithContentValuesAndDependentAttributes(jsAttributeName, contentAttributeName, validValue1, validValue1, validValue2, validValue2, name, elementName, getParentElement, setAttributes, interfaceName); +} + +function testReflectBooleanAttributeWithDependentAttributes(jsAttributeName, contentAttributeName, name, elementName, getParentElement, setAttributes, interfaceName) { + testReflectAttributeWithContentValuesAndDependentAttributes(jsAttributeName, contentAttributeName, true, '', false, null, name, elementName, getParentElement, setAttributes, interfaceName); +} + +function testReflectAttributeWithContentValuesAndParentNode(jsAttributeName, contentAttributeName, validValue1, contentValue1, validValue2, contentValue2, name, elementName, getParentElement, interfaceName) { + let parentElement = getParentElement(); + + test(() => { + let element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName); + let instance = document.createElement(elementName, { is: element.name }); + + assert_array_equals(element.takeLog().types(), ['constructed']); + parentElement.appendChild(instance); + assert_array_equals(element.takeLog().types(), ['connected']); + instance[jsAttributeName] = validValue1; + let logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), { name: contentAttributeName, oldValue: null, newValue: contentValue1, namespace: null }); +}, name + ' must enqueue an attributeChanged reaction when adding a new attribute'); + + test(() => { + let element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName); + let instance = document.createElement(elementName, { is: element.name }); + parentElement.appendChild(instance); + + assert_array_equals(element.takeLog().types(), ['constructed', 'connected']); + instance[jsAttributeName] = validValue1; + assert_array_equals(element.takeLog().types(), ['attributeChanged']); + instance[jsAttributeName] = validValue2; + let logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), { name: contentAttributeName, oldValue: contentValue1, newValue: contentValue2, namespace: null }); + }, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute'); +} + +function testReflectAttributeWithParentNode(jsAttributeName, contentAttributeName, validValue1, validValue2, name, elementName, getParentElement, interfaceName) { + testReflectAttributeWithContentValuesAndParentNode(jsAttributeName, contentAttributeName, validValue1, validValue1, validValue2, validValue2, name, elementName, getParentElement, interfaceName); +} + +function testReflectBooleanAttributeWithParentNode(jsAttributeName, contentAttributeName, name, elementName, getParentElement, interfaceName) { + testReflectAttributeWithContentValuesAndParentNode(jsAttributeName, contentAttributeName, true, '', false, null, name, elementName, getParentElement, interfaceName); +} + +function testAttributeAdder(testFunction, name) { + test(function () { + var element = define_new_custom_element(['id']); + var instance = document.createElement(element.name); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, 'id', 'foo'); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: 'id', oldValue: null, newValue: 'foo', namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when adding an attribute'); + + test(function () { + var element = define_new_custom_element(['class']); + var instance = document.createElement(element.name); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, 'data-lang', 'en'); + assert_array_equals(element.takeLog().types(), []); + }, name + ' must not enqueue an attributeChanged reaction when adding an unobserved attribute'); + + test(function () { + var element = define_new_custom_element(['title']); + var instance = document.createElement(element.name); + instance.setAttribute('title', 'hello'); + assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']); + testFunction(instance, 'title', 'world'); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: 'title', oldValue: 'hello', newValue: 'world', namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute'); + + test(function () { + var element = define_new_custom_element([]); + var instance = document.createElement(element.name); + instance.setAttribute('data-lang', 'zh'); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, 'data-lang', 'en'); + assert_array_equals(element.takeLog().types(), []); + }, name + ' must enqueue an attributeChanged reaction when replacing an existing unobserved attribute'); +} + +function testAttributeMutator(testFunction, name) { + test(function () { + var element = define_new_custom_element(['title']); + var instance = document.createElement(element.name); + instance.setAttribute('title', 'hello'); + assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']); + testFunction(instance, 'title', 'world'); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: 'title', oldValue: 'hello', newValue: 'world', namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute'); + + test(function () { + var element = define_new_custom_element(['class']); + var instance = document.createElement(element.name); + instance.setAttribute('data-lang', 'zh'); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, 'data-lang', 'en'); + assert_array_equals(element.takeLog().types(), []); + }, name + ' must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute'); +} + +function testAttributeRemover(testFunction, name, options) { + if (options && !options.onlyExistingAttribute) { + test(function () { + var element = define_new_custom_element(['title']); + var instance = document.createElement(element.name); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, 'title'); + assert_array_equals(element.takeLog().types(), []); + }, name + ' must not enqueue an attributeChanged reaction when removing an attribute that does not exist'); + } + + test(function () { + var element = define_new_custom_element([]); + var instance = document.createElement(element.name); + instance.setAttribute('data-lang', 'hello'); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, 'data-lang'); + assert_array_equals(element.takeLog().types(), []); + }, name + ' must not enqueue an attributeChanged reaction when removing an unobserved attribute'); + + test(function () { + var element = define_new_custom_element(['title']); + var instance = document.createElement(element.name); + instance.setAttribute('title', 'hello'); + assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']); + testFunction(instance, 'title'); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: 'title', oldValue: 'hello', newValue: null, namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when removing an existing attribute'); + + test(function () { + var element = define_new_custom_element([]); + var instance = document.createElement(element.name); + instance.setAttribute('data-lang', 'ja'); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, 'data-lang'); + assert_array_equals(element.takeLog().types(), []); + }, name + ' must not enqueue an attributeChanged reaction when removing an existing unobserved attribute'); +} + +function test_mutating_style_property_value(testFunction, name, options) { + const propertyName = (options || {}).propertyName || 'color'; + const idlName = (options || {}).idlName || 'color'; + const value1 = (options || {}).value1 || 'blue'; + const rule1 = `${propertyName}: ${value1};`; + const value2 = (options || {}).value2 || 'red'; + const rule2 = `${propertyName}: ${value2};`; + + test(function () { + var element = define_new_custom_element(['style']); + var instance = document.createElement(element.name); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, propertyName, idlName, value1); + assert_equals(instance.getAttribute('style'), rule1); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: null, newValue: rule1, namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when it adds the observed style attribute'); + + test(function () { + var element = define_new_custom_element(['title']); + var instance = document.createElement(element.name); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, propertyName, idlName, value1); + assert_equals(instance.getAttribute('style'), rule1); + assert_array_equals(element.takeLog().types(), []); + }, name + ' must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed'); + + test(function () { + var element = define_new_custom_element(['style']); + var instance = document.createElement(element.name); + testFunction(instance, propertyName, idlName, value1); + assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']); + testFunction(instance, propertyName, idlName, value2); + assert_equals(instance.getAttribute('style'), rule2); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: rule1, newValue: rule2, namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when it mutates the observed style attribute'); + + test(function () { + var element = define_new_custom_element([]); + var instance = document.createElement(element.name); + testFunction(instance, propertyName, idlName, value1); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, propertyName, idlName, value2); + assert_equals(instance.getAttribute('style'), rule2); + assert_array_equals(element.takeLog().types(), []); + }, name + ' must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed'); +} + +function test_removing_style_property_value(testFunction, name) { + test(function () { + var element = define_new_custom_element(['style']); + var instance = document.createElement(element.name); + instance.setAttribute('style', 'color: red; display: none;'); + assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']); + testFunction(instance, 'color', 'color'); + assert_equals(instance.getAttribute('style'), 'display: none;'); // Don't make this empty since browser behaviors are inconsistent now. + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: 'color: red; display: none;', newValue: 'display: none;', namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when it removes a property from the observed style attribute'); + + test(function () { + var element = define_new_custom_element(['class']); + var instance = document.createElement(element.name); + instance.setAttribute('style', 'color: red; display: none;'); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, 'color', 'color'); + assert_equals(instance.getAttribute('style'), 'display: none;'); // Don't make this empty since browser behaviors are inconsistent now. + assert_array_equals(element.takeLog().types(), []); + }, name + ' must not enqueue an attributeChanged reaction when it removes a property from the style attribute but the style attribute is not observed'); +} + +function test_mutating_style_property_priority(testFunction, name) { + test(function () { + var element = define_new_custom_element(['style']); + var instance = document.createElement(element.name); + instance.setAttribute('style', 'color: red'); + assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']); + testFunction(instance, 'color', 'color', true); + assert_equals(instance.getAttribute('style'), 'color: red !important;'); + var logEntries = element.takeLog(); + assert_array_equals(logEntries.types(), ['attributeChanged']); + assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: 'color: red', newValue: 'color: red !important;', namespace: null}); + }, name + ' must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed'); + + test(function () { + var element = define_new_custom_element(['id']); + var instance = document.createElement(element.name); + instance.setAttribute('style', 'color: red'); + assert_array_equals(element.takeLog().types(), ['constructed']); + testFunction(instance, 'color', 'color', true); + assert_equals(instance.getAttribute('style'), 'color: red !important;'); + assert_array_equals(element.takeLog().types(), []); + }, name + ' must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed'); +} diff --git a/testing/web-platform/tests/custom-elements/reactions/with-exceptions.html b/testing/web-platform/tests/custom-elements/reactions/with-exceptions.html new file mode 100644 index 0000000000..131348b1c4 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/reactions/with-exceptions.html @@ -0,0 +1,35 @@ + + +Custom Elements: CEReactions interaction with exceptions + + + + + + + + +
+ + -- cgit v1.2.3