Changeset 208360 in webkit


Ignore:
Timestamp:
Nov 3, 2016 6:37:01 PM (7 years ago)
Author:
rniwa@webkit.org
Message:

Update custom elements tests
https://bugs.webkit.org/show_bug.cgi?id=164352

Reviewed by Antti Koivisto.
LayoutTests/imported/w3c:

Reimported the custom elements tests as of 5047c27a5c61cc12eab75ac72b86125ec3cc8527.

  • web-platform-tests/custom-elements/custom-element-reaction-queue-expected.txt: Added.
  • web-platform-tests/custom-elements/custom-element-reaction-queue.html: Added.
  • web-platform-tests/custom-elements/htmlconstructor/newtarget.html:
  • web-platform-tests/custom-elements/reactions/CSSStyleDeclaration-expected.txt: Moved from fast/custom-elements/reactions/.
  • web-platform-tests/custom-elements/reactions/CSSStyleDeclaration.html: Ditto.
  • web-platform-tests/custom-elements/reactions/Document.html: Updated.
  • web-platform-tests/custom-elements/reactions/HTMLAnchorElement-expected.txt: Moved from fast/custom-elements/reactions/.
  • web-platform-tests/custom-elements/reactions/HTMLAnchorElement.html: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLOptionElement-expected.txt: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLOptionElement.html: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLOptionsCollection-expected.txt: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLOptionsCollection.html: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLOutputElement-expected.txt: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLOutputElement.html: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLSelectElement-expected.txt: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLSelectElement.html: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLTableElement-expected.txt: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLTableElement.html: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLTableRowElement-expected.txt: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLTableRowElement.html: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLTableSectionElement-expected.txt: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLTableSectionElement.html: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLTitleElement-expected.txt: Ditto.
  • web-platform-tests/custom-elements/reactions/HTMLTitleElement.html: Ditto.
  • web-platform-tests/custom-elements/reactions/ShadowRoot-expected.txt: Ditto.
  • web-platform-tests/custom-elements/reactions/ShadowRoot.html: Ditto.
  • web-platform-tests/custom-elements/reactions/resources/reactions.js:
  • web-platform-tests/custom-elements/reactions/w3c-import.log:
  • web-platform-tests/custom-elements/resources/custom-elements-helpers.js:
  • web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions-expected.txt: Moved from fast/custom-elements/.
  • web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions.html: Ditto.
  • web-platform-tests/custom-elements/upgrading/w3c-import.log:
  • web-platform-tests/custom-elements/w3c-import.log:

LayoutTests:

Removed tests that have been back imported via web-platform-tests.

  • fast/custom-elements/custom-element-reaction-queue-expected.txt: Removed.
  • fast/custom-elements/custom-element-reaction-queue.html: Removed.
  • fast/custom-elements/reactions-for-webkit-extensions.html:
  • fast/custom-elements/reactions/: Removed.
  • fast/custom-elements/resources/additional-helpers.js: Removed.
  • fast/custom-elements/upgrading-enqueue-reactions-expected.txt: Removed.
  • fast/custom-elements/upgrading-enqueue-reactions.html: Removed.
Location:
trunk/LayoutTests
Files:
1 added
2 deleted
11 edited
21 copied
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r208359 r208360  
     12016-11-03  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Update custom elements tests
     4        https://bugs.webkit.org/show_bug.cgi?id=164352
     5
     6        Reviewed by Antti Koivisto.
     7       
     8        Removed tests that have been back imported via web-platform-tests.
     9
     10        * fast/custom-elements/custom-element-reaction-queue-expected.txt: Removed.
     11        * fast/custom-elements/custom-element-reaction-queue.html: Removed.
     12        * fast/custom-elements/reactions-for-webkit-extensions.html:
     13        * fast/custom-elements/reactions/: Removed.
     14        * fast/custom-elements/resources/additional-helpers.js: Removed.
     15        * fast/custom-elements/upgrading-enqueue-reactions-expected.txt: Removed.
     16        * fast/custom-elements/upgrading-enqueue-reactions.html: Removed.
     17
    1182016-11-03  Brady Eidson  <beidson@apple.com>
    219
  • trunk/LayoutTests/fast/custom-elements/reactions-for-webkit-extensions.html

    r208082 r208360  
    1010<script src="../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    1111<script src="../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="resources/additional-helpers.js"></script>
    1312</head>
    1413<body>
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r208359 r208360  
     12016-11-03  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        Update custom elements tests
     4        https://bugs.webkit.org/show_bug.cgi?id=164352
     5
     6        Reviewed by Antti Koivisto.
     7
     8        Reimported the custom elements tests as of 5047c27a5c61cc12eab75ac72b86125ec3cc8527.
     9
     10        * web-platform-tests/custom-elements/custom-element-reaction-queue-expected.txt: Added.
     11        * web-platform-tests/custom-elements/custom-element-reaction-queue.html: Added.
     12        * web-platform-tests/custom-elements/htmlconstructor/newtarget.html:
     13        * web-platform-tests/custom-elements/reactions/CSSStyleDeclaration-expected.txt: Moved from fast/custom-elements/reactions/.
     14        * web-platform-tests/custom-elements/reactions/CSSStyleDeclaration.html: Ditto.
     15        * web-platform-tests/custom-elements/reactions/Document.html: Updated.
     16        * web-platform-tests/custom-elements/reactions/HTMLAnchorElement-expected.txt: Moved from fast/custom-elements/reactions/.
     17        * web-platform-tests/custom-elements/reactions/HTMLAnchorElement.html: Ditto.
     18        * web-platform-tests/custom-elements/reactions/HTMLOptionElement-expected.txt: Ditto.
     19        * web-platform-tests/custom-elements/reactions/HTMLOptionElement.html: Ditto.
     20        * web-platform-tests/custom-elements/reactions/HTMLOptionsCollection-expected.txt: Ditto.
     21        * web-platform-tests/custom-elements/reactions/HTMLOptionsCollection.html: Ditto.
     22        * web-platform-tests/custom-elements/reactions/HTMLOutputElement-expected.txt: Ditto.
     23        * web-platform-tests/custom-elements/reactions/HTMLOutputElement.html: Ditto.
     24        * web-platform-tests/custom-elements/reactions/HTMLSelectElement-expected.txt: Ditto.
     25        * web-platform-tests/custom-elements/reactions/HTMLSelectElement.html:  Ditto.
     26        * web-platform-tests/custom-elements/reactions/HTMLTableElement-expected.txt: Ditto.
     27        * web-platform-tests/custom-elements/reactions/HTMLTableElement.html: Ditto.
     28        * web-platform-tests/custom-elements/reactions/HTMLTableRowElement-expected.txt: Ditto.
     29        * web-platform-tests/custom-elements/reactions/HTMLTableRowElement.html: Ditto.
     30        * web-platform-tests/custom-elements/reactions/HTMLTableSectionElement-expected.txt: Ditto.
     31        * web-platform-tests/custom-elements/reactions/HTMLTableSectionElement.html: Ditto.
     32        * web-platform-tests/custom-elements/reactions/HTMLTitleElement-expected.txt: Ditto.
     33        * web-platform-tests/custom-elements/reactions/HTMLTitleElement.html: Ditto.
     34        * web-platform-tests/custom-elements/reactions/ShadowRoot-expected.txt: Ditto.
     35        * web-platform-tests/custom-elements/reactions/ShadowRoot.html: Ditto.
     36        * web-platform-tests/custom-elements/reactions/resources/reactions.js:
     37        * web-platform-tests/custom-elements/reactions/w3c-import.log:
     38        * web-platform-tests/custom-elements/resources/custom-elements-helpers.js:
     39        * web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions-expected.txt: Moved from fast/custom-elements/.
     40        * web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions.html: Ditto.
     41        * web-platform-tests/custom-elements/upgrading/w3c-import.log:
     42        * web-platform-tests/custom-elements/w3c-import.log:
     43
    1442016-11-03  Brady Eidson  <beidson@apple.com>
    245
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue.html

    r208359 r208360  
    66<meta name="assert" content="Each element must have its own custom element reaction queue">
    77<meta name="help" content="https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reaction-queue">
    8 <script src="../../resources/testharness.js"></script>
    9 <script src="../../resources/testharnessreport.js"></script>
    10 <script src="../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="./resources/custom-elements-helpers.js"></script>
    1111</head>
    1212<body>
    1313<div id="log"></div>
    1414<script>
    15 
    16 function create_constructor_log(element) {
    17     return {type: 'constructed', element: element};
    18 }
    19 
    20 function assert_constructor_log_entry(log, element) {
    21     assert_equals(log.type, 'constructed');
    22     assert_equals(log.element, element);
    23 }
    24 
    25 function assert_adopted_log_entry(log, element) {
    26     assert_equals(log.type, 'adopted');
    27     assert_equals(log.element, element);
    28 }
    29 
    30 function create_adopted_callback_log(element) {
    31     return {type: 'adopted', element: element};
    32 }
    33 
    34 function create_connected_callback_log(element) {
    35     return {type: 'connected', element: element};
    36 }
    37 
    38 function assert_connected_log_entry(log, element) {
    39     assert_equals(log.type, 'connected');
    40     assert_equals(log.element, element);
    41 }
    4215
    4316test_with_window(function (contentWindow) {
     
    9366            super();
    9467            log.push(create_constructor_log(this));
    95             if (this == element1)
     68            if (this == element1) {
     69                element2.setAttribute('title', 'hi');
     70                element2.removeAttribute('title');
    9671                element2.setAttribute('class', 'foo');
     72            }
    9773        }
    9874        connectedCallback(...args) {
     
    10278            log.push(create_attribute_changed_callback_log(this, ...args));
    10379        }
    104         static get observedAttributes() { return ['id', 'class']; }
     80        static get observedAttributes() { return ['id', 'class', 'title']; }
    10581    }
    10682    contentWindow.customElements.define('test-element', TestElement);
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html

    r207520 r208360  
    102102      const o = Reflect.construct(w.HTMLParagraphElement, [], new.target);
    103103
    104       assert_equals(Object.getPrototypeOf(o), window.HTMLParagraphElement,
     104      assert_equals(Object.getPrototypeOf(o), window.HTMLParagraphElement.prototype,
    105105        "Must use the HTMLParagraphElement from the realm of NewTarget");
    106       assert_not_equals(Object.getPrototypeOf(o), w.HTMLParagraphElement,
     106      assert_not_equals(Object.getPrototypeOf(o), w.HTMLParagraphElement.prototype,
    107107        "Must not use the HTMLParagraphElement from the realm of the active function object (w.HTMLParagraphElement)");
    108108
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration-expected.txt

    r208359 r208360  
    1010PASS setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed
    1111PASS setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed
     12FAIL setPropertyValue on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute instance.style.setPropertyValue is not a function. (In 'instance.style.setPropertyValue(propertyName, value)', 'instance.style.setPropertyValue' is undefined)
     13FAIL setPropertyValue on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed instance.style.setPropertyValue is not a function. (In 'instance.style.setPropertyValue(propertyName, value)', 'instance.style.setPropertyValue' is undefined)
     14FAIL setPropertyValue on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute instance.style.setPropertyValue is not a function. (In 'instance.style.setPropertyValue(propertyName, value)', 'instance.style.setPropertyValue' is undefined)
     15FAIL setPropertyValue on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed instance.style.setPropertyValue is not a function. (In 'instance.style.setPropertyValue(propertyName, value)', 'instance.style.setPropertyValue' is undefined)
     16FAIL setPropertyPriority on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed instance.style.setPropertyPriority is not a function. (In 'instance.style.setPropertyPriority(propertyName, isImportant ? 'important': '')', 'instance.style.setPropertyPriority' is undefined)
     17FAIL setPropertyPriority on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed instance.style.setPropertyPriority is not a function. (In 'instance.style.setPropertyPriority(propertyName, isImportant ? 'important': '')', 'instance.style.setPropertyPriority' is undefined)
    1218PASS removeProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it removes a property from the observed style attribute
    1319PASS removeProperty on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it removes a property from the style attribute but the style attribute is not observed
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt

    r207703 r208360  
    44PASS adoptNode on Document must enqueue an adopted reaction when importing a custom element
    55PASS execCommand on Document must enqueue a disconnected reaction when deleting a custom element from a contenteditable element
     6PASS title on Document must enqueue disconnectedCallback when removing a custom element
     7PASS body on Document must enqueue disconnectedCallback when removing a custom element
     8PASS body on Document must enqueue connectedCallback when inserting a custom element
     9PASS open on Document must enqueue disconnectedCallback when removing a custom element
     10PASS write on Document must enqueue disconnectedCallback when removing a custom element
     11PASS write on Document must enqueue connectedCallback after constructing a custom element
     12PASS writeln on Document must enqueue disconnectedCallback when removing a custom element
     13PASS writeln on Document must enqueue connectedCallback after constructing a custom element
    614
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html

    r207703 r208360  
    1616<script>
    1717
    18 test(function () {
    19     var element = define_new_custom_element();
    20     var instance = document.createElement(element.name);
     18test_with_window(function (contentWindow, contentDocument) {
     19    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     20    const instance = contentDocument.createElement('custom-element');
    2121    assert_array_equals(element.takeLog().types(), ['constructed']);
    2222
    23     var newDoc = document.implementation.createHTMLDocument();
     23    const newDoc = contentDocument.implementation.createHTMLDocument();
    2424    newDoc.importNode(instance);
    2525
     
    2727}, 'importNode on Document must not construct a new custom element when importing a custom element into a window-less document');
    2828
    29 test(function () {
    30     var element = define_new_custom_element();
    31     var template = document.createElement('template');
    32     template.innerHTML = `<${element.name}></${element.name}>`;
     29test_with_window(function (contentWindow, contentDocument) {
     30    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     31    const template = contentDocument.createElement('template');
     32    template.innerHTML = '<custom-element></custom-element>';
    3333    assert_array_equals(element.takeLog().types(), []);
    34     document.importNode(template.content, true);
     34    contentDocument.importNode(template.content, true);
    3535    assert_array_equals(element.takeLog().types(), ['constructed']);
    3636}, 'importNode on Document must construct a new custom element when importing a custom element from a template');
    3737
    38 test(function () {
    39     var element = define_new_custom_element();
    40     var instance = document.createElement(element.name);
     38test_with_window(function (contentWindow, contentDocument) {
     39    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     40    const instance = contentDocument.createElement('custom-element');
    4141    assert_array_equals(element.takeLog().types(), ['constructed']);
    4242
    43     var newDoc = document.implementation.createHTMLDocument();
     43    const newDoc = contentDocument.implementation.createHTMLDocument();
    4444    newDoc.adoptNode(instance);
    4545
    46     var logEntries = element.takeLog();
     46    const logEntries = element.takeLog();
    4747    assert_array_equals(logEntries.types(), ['adopted']);
    48     assert_equals(logEntries.last().oldDocument, document);
     48    assert_equals(logEntries.last().oldDocument, contentDocument);
    4949    assert_equals(logEntries.last().newDocument, newDoc);
    5050}, 'adoptNode on Document must enqueue an adopted reaction when importing a custom element');
    5151
    52 test(function () {
    53     var element = define_new_custom_element();
    54     var instance = document.createElement(element.name);
     52test_with_window(function (contentWindow, contentDocument) {
     53    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     54    const instance = contentDocument.createElement('custom-element');
    5555
    56     var container = document.createElement('div');
     56    const container = contentDocument.createElement('div');
    5757    container.contentEditable = true;
    5858    container.appendChild(instance);
    59     document.body.appendChild(container);
     59    contentDocument.body.appendChild(container);
    6060
    6161    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
    6262
    6363    container.focus();
    64     document.execCommand('delete', false, null);
     64    contentDocument.execCommand('delete', false, null);
    6565
    6666    assert_array_equals(element.takeLog().types(), ['disconnected']);
    6767}, 'execCommand on Document must enqueue a disconnected reaction when deleting a custom element from a contenteditable element');
    6868
     69test_with_window(function (contentWindow, contentDocument) {
     70    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     71
     72    contentDocument.title = '';
     73    const title = contentDocument.querySelector('title');
     74    const instance = contentDocument.createElement('custom-element');
     75    title.appendChild(instance);
     76    instance.textContent = 'hello';
     77
     78    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
     79    assert_equals(title.innerHTML, '<custom-element>hello</custom-element>');
     80
     81    title.text = 'world';
     82    assert_equals(title.innerHTML, 'world');
     83    assert_array_equals(element.takeLog().types(), ['disconnected']);
     84}, 'title on Document must enqueue disconnectedCallback when removing a custom element');
     85
     86test_with_window(function (contentWindow, contentDocument) {
     87    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     88
     89    const body = contentDocument.body;
     90    body.innerHTML = '<custom-element>hello</custom-element>';
     91
     92    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
     93    assert_equals(body.innerHTML, '<custom-element>hello</custom-element>');
     94
     95    contentDocument.body = contentDocument.createElement('body');
     96    assert_array_equals(element.takeLog().types(), ['disconnected']);
     97}, 'body on Document must enqueue disconnectedCallback when removing a custom element');
     98
     99test_with_window(function (contentWindow, contentDocument) {
     100    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     101
     102    const instance = contentDocument.createElement('custom-element');
     103    const body = contentDocument.createElement('body');
     104    body.appendChild(instance);
     105
     106    assert_array_equals(element.takeLog().types(), ['constructed']);
     107    assert_equals(body.innerHTML, '<custom-element></custom-element>');
     108
     109    contentDocument.body = body;
     110    assert_array_equals(element.takeLog().types(), ['connected']);
     111}, 'body on Document must enqueue connectedCallback when inserting a custom element');
     112
     113test_with_window(function (contentWindow, contentDocument) {
     114    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     115    contentDocument.body.innerHTML = '<custom-element></custom-element>';
     116    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
     117
     118    contentDocument.open();
     119    assert_array_equals(element.takeLog().types(), ['disconnected']);
     120}, 'open on Document must enqueue disconnectedCallback when removing a custom element');
     121
     122test_with_window(function (contentWindow, contentDocument) {
     123    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     124    contentDocument.body.innerHTML = '<custom-element></custom-element>';
     125    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
     126
     127    contentDocument.write('');
     128    assert_array_equals(element.takeLog().types(), ['disconnected']);
     129}, 'write on Document must enqueue disconnectedCallback when removing a custom element');
     130
     131test_with_window(function (contentWindow, contentDocument) {
     132    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     133    contentWindow.document.write('<custom-element></custom-element>');
     134    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
     135}, 'write on Document must enqueue connectedCallback after constructing a custom element');
     136
     137test_with_window(function (contentWindow, contentDocument) {
     138    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     139    contentDocument.body.innerHTML = '<custom-element></custom-element>';
     140    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
     141
     142    contentDocument.writeln('');
     143    assert_array_equals(element.takeLog().types(), ['disconnected']);
     144}, 'writeln on Document must enqueue disconnectedCallback when removing a custom element');
     145
     146test_with_window(function (contentWindow) {
     147    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
     148    contentWindow.document.writeln('<custom-element></custom-element>');
     149    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
     150}, 'writeln on Document must enqueue connectedCallback after constructing a custom element');
     151
    69152</script>
    70153</body>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement.html

    r208359 r208360  
    66<meta name="assert" content="text of HTMLAnchorElement interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    20 
    21     const contentDocument = contentWindow.document;
    2219    contentDocument.body.innerHTML = `<a><custom-element>hello</custom-element></a>`;
    2320    const anchor = contentDocument.querySelector('a');
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement.html

    r208359 r208360  
    66<meta name="assert" content="text of HTMLOptionElement interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    20 
    21     const contentDocument = contentWindow.document;
    2219    contentDocument.body.innerHTML = `<select><option></option></select>`;
    2320    const option = contentDocument.querySelector('option');
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection.html

    r208359 r208360  
    66<meta name="assert" content="length, the indexed setter, add, and remove of HTMLOptionsCollection interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    20 
    21     const contentDocument = contentWindow.document;
    2219    contentDocument.body.innerHTML = `<select><option></option></select>`;
    2320    const option = contentDocument.querySelector('option');
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement.html

    r208359 r208360  
    66<meta name="assert" content="value and defaultValue of HTMLOutputElement interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    20 
    21     const contentDocument = contentWindow.document;
    2219    contentDocument.body.innerHTML = `<output><custom-element>hello</custom-element></output>`;
    2320    const anchor = contentDocument.querySelector('output');
     
    3128}, 'value on HTMLOutputElement must enqueue disconnectedCallback when removing a custom element');
    3229
    33 test_with_window(function (contentWindow) {
     30test_with_window(function (contentWindow, contentDocument) {
    3431    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    35 
    36     const contentDocument = contentWindow.document;
    3732    contentDocument.body.innerHTML = `<output><custom-element>hello</custom-element></output>`;
    3833    const anchor = contentDocument.querySelector('output');
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement.html

    r208359 r208360  
    66<meta name="assert" content="length, add, remove, and the setter of HTMLSelectElement interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    20 
    21     const contentDocument = contentWindow.document;
    2219    contentDocument.body.innerHTML = `<select><option></option></select>`;
    2320    const option = contentDocument.querySelector('option');
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement.html

    r208359 r208360  
    66<meta name="assert" content="caption, deleteCaption, thead, deleteTHead, tFoot, deleteTFoot, and deleteRow of HTMLTableElement interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    20 
    21     const contentDocument = contentWindow.document;
    2219    contentDocument.body.innerHTML = `<table></table>`;
    2320    const table = contentDocument.querySelector('table');
     
    3431}, 'caption on HTMLTableElement must enqueue connectedCallback when inserting a custom element');
    3532
    36 test_with_window(function (contentWindow) {
     33test_with_window(function (contentWindow, contentDocument) {
    3734    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    38 
    39     const contentDocument = contentWindow.document;
    4035    contentDocument.body.innerHTML = `<table><caption><custom-element>hello</custom-element></caption></table>`;
    4136    const caption = contentDocument.querySelector('caption');
     
    5146}, 'caption on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
    5247
    53 test_with_window(function (contentWindow) {
     48test_with_window(function (contentWindow, contentDocument) {
    5449    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    55 
    56     const contentDocument = contentWindow.document;
    5750    contentDocument.body.innerHTML = `<table><caption><custom-element>hello</custom-element></caption></table>`;
    5851    const caption = contentDocument.querySelector('caption');
     
    6962
    7063
    71 test_with_window(function (contentWindow) {
     64test_with_window(function (contentWindow, contentDocument) {
    7265    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    73 
    74     const contentDocument = contentWindow.document;
    7566    contentDocument.body.innerHTML = `<table></table>`;
    7667    const table = contentDocument.querySelector('table');
     
    8778}, 'tHead on HTMLTableElement must enqueue connectedCallback when inserting a custom element');
    8879
    89 test_with_window(function (contentWindow) {
     80test_with_window(function (contentWindow, contentDocument) {
    9081    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    91 
    92     const contentDocument = contentWindow.document;
    9382    contentDocument.body.innerHTML = `<table><thead><tr><td><custom-element>hello</custom-element></td></tr></thead></table>`;
    9483    const thead = contentDocument.querySelector('thead');
     
    10493}, 'tHead on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
    10594
    106 test_with_window(function (contentWindow) {
     95test_with_window(function (contentWindow, contentDocument) {
    10796    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    108 
    109     const contentDocument = contentWindow.document;
    11097    contentDocument.body.innerHTML = `<table><thead><tr><td><custom-element>hello</custom-element></td></tr></thead></table>`;
    11198    const thead = contentDocument.querySelector('thead');
     
    121108
    122109
    123 test_with_window(function (contentWindow) {
     110test_with_window(function (contentWindow, contentDocument) {
    124111    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    125 
    126     const contentDocument = contentWindow.document;
    127112    contentDocument.body.innerHTML = `<table></table>`;
    128113    const table = contentDocument.querySelector('table');
     
    139124}, 'tFoot on HTMLTableElement must enqueue connectedCallback when inserting a custom element');
    140125
    141 test_with_window(function (contentWindow) {
     126test_with_window(function (contentWindow, contentDocument) {
    142127    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    143 
    144     const contentDocument = contentWindow.document;
    145128    contentDocument.body.innerHTML = `<table><tfoot><tr><td><custom-element>hello</custom-element></td></tr></tfoot></table>`;
    146129    const tfoot = contentDocument.querySelector('tfoot');
     
    156139}, 'tFoot on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
    157140
    158 test_with_window(function (contentWindow) {
     141test_with_window(function (contentWindow, contentDocument) {
    159142    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    160 
    161     const contentDocument = contentWindow.document;
    162143    contentDocument.body.innerHTML = `<table><tfoot><tr><td><custom-element>hello</custom-element></td></tr></tfoot></table>`;
    163144    const tfoot = contentDocument.querySelector('tfoot');
     
    173154
    174155
    175 test_with_window(function (contentWindow) {
     156test_with_window(function (contentWindow, contentDocument) {
    176157    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    177 
    178     const contentDocument = contentWindow.document;
    179158    contentDocument.body.innerHTML = `<table><tr><td><custom-element>hello</custom-element></td></tr></table>`;
    180159    const tr = contentDocument.querySelector('tr');
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement.html

    r208359 r208360  
    66<meta name="assert" content="deleteCell of HTMLTableRowElement interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    20 
    21     const contentDocument = contentWindow.document;
    2219    contentDocument.body.innerHTML = `<table><tr><td><custom-element>hello</custom-element></td></tr></table>`;
    2320    const td = contentDocument.querySelector('td');
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement.html

    r208359 r208360  
    66<meta name="assert" content="deleteRow of HTMLTableSectionElement interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    20 
    21     const contentDocument = contentWindow.document;
    2219    contentDocument.body.innerHTML = `<table><thead><tr><td><custom-element>hello</custom-element></td></tr></thead></table>`;
    2320    const thead = contentDocument.querySelector('thead');
     
    3128}, 'deleteRow() on HTMLTableSectionElement on thead must enqueue disconnectedCallback when removing a custom element');
    3229
    33 test_with_window(function (contentWindow) {
     30test_with_window(function (contentWindow, contentDocument) {
    3431    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    35 
    36     const contentDocument = contentWindow.document;
    3732    contentDocument.body.innerHTML = `<table><tfoot><tr><td><custom-element>hello</custom-element></td></tr></tfoot></table>`;
    3833    const tfoot = contentDocument.querySelector('tfoot');
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement.html

    r208359 r208360  
    66<meta name="assert" content="text of HTMLTitleElement interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    2019    const instance = contentWindow.document.createElement(element.name);
     
    2221
    2322    contentWindow.document.title = 'hello';
    24     var titleElement = contentWindow.document.querySelector('title');
     23    const titleElement = contentDocument.querySelector('title');
    2524    titleElement.appendChild(instance);
    2625    assert_array_equals(element.takeLog().types(), ['connected']);
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot.html

    r208359 r208360  
    66<meta name="assert" content="innerHTML of ShadowRoot interface must have CEReactions">
    77<meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../../resources/testharness.js"></script>
    9 <script src="../../../resources/testharnessreport.js"></script>
    10 <script src="../../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="../../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
    12 <script src="../resources/additional-helpers.js"></script>
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
     11<script src="./resources/reactions.js"></script>
    1312</head>
    1413<body>
     
    1615<script>
    1716
    18 test_with_window(function (contentWindow) {
     17test_with_window(function (contentWindow, contentDocument) {
    1918    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    20 
    21     const contentDocument = contentWindow.document;
    2219    const host = contentDocument.createElement('div');
    2320    const shadowRoot = host.attachShadow({mode: 'closed'});
     
    2724}, 'innerHTML on ShadowRoot must upgrade a custom element');
    2825
    29 test_with_window(function (contentWindow) {
     26test_with_window(function (contentWindow, contentDocument) {
    3027    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    31 
    32     const contentDocument = contentWindow.document;
    3328    const host = contentDocument.createElement('div');
    3429    contentDocument.body.appendChild(host);
     
    3934}, 'innerHTML on ShadowRoot must enqueue connectedCallback on newly upgraded custom elements when the shadow root is connected');
    4035
    41 test_with_window(function (contentWindow) {
     36test_with_window(function (contentWindow, contentDocument) {
    4237    const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
    43 
    44     const contentDocument = contentWindow.document;
    4538    const host = contentDocument.createElement('div');
    4639    contentDocument.body.appendChild(host);
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js

    r207703 r208360  
    261261    }, name + ' must not enqueue an attributeChanged reaction when removing an existing unobserved attribute');
    262262}
     263
     264function test_mutating_style_property_value(testFunction, name, options) {
     265    const propertyName = (options || {}).propertyName || 'color';
     266    const idlName = (options || {}).idlName || 'color';
     267    const value1 = (options || {}).value1 || 'blue';
     268    const rule1 = `${propertyName}: ${value1};`;
     269    const value2 = (options || {}).value2 || 'red';
     270    const rule2 = `${propertyName}: ${value2};`;
     271
     272    test(function () {
     273        var element = define_new_custom_element(['style']);
     274        var instance = document.createElement(element.name);
     275        assert_array_equals(element.takeLog().types(), ['constructed']);
     276        testFunction(instance, propertyName, idlName, value1);
     277        assert_equals(instance.getAttribute('style'), rule1);
     278        var logEntries = element.takeLog();
     279        assert_array_equals(logEntries.types(), ['attributeChanged']);
     280        assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: null, newValue: rule1, namespace: null});
     281    }, name + ' must enqueue an attributeChanged reaction when it adds the observed style attribute');
     282
     283    test(function () {
     284        var element = define_new_custom_element(['title']);
     285        var instance = document.createElement(element.name);
     286        assert_array_equals(element.takeLog().types(), ['constructed']);
     287        testFunction(instance, propertyName, idlName, value1);
     288        assert_equals(instance.getAttribute('style'), rule1);
     289        assert_array_equals(element.takeLog().types(), []);
     290    }, name + ' must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed');
     291
     292    test(function () {
     293        var element = define_new_custom_element(['style']);
     294        var instance = document.createElement(element.name);
     295        testFunction(instance, propertyName, idlName, value1);
     296        assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
     297        testFunction(instance, propertyName, idlName, value2);
     298        assert_equals(instance.getAttribute('style'), rule2);
     299        var logEntries = element.takeLog();
     300        assert_array_equals(logEntries.types(), ['attributeChanged']);
     301        assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: rule1, newValue: rule2, namespace: null});
     302    }, name + ' must enqueue an attributeChanged reaction when it mutates the observed style attribute');
     303
     304    test(function () {
     305        var element = define_new_custom_element([]);
     306        var instance = document.createElement(element.name);
     307        testFunction(instance, propertyName, idlName, value1);
     308        assert_array_equals(element.takeLog().types(), ['constructed']);
     309        testFunction(instance, propertyName, idlName, value2);
     310        assert_equals(instance.getAttribute('style'), rule2);
     311        assert_array_equals(element.takeLog().types(), []);
     312    }, name + ' must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed');
     313}
     314
     315function test_removing_style_property_value(testFunction, name) {
     316    test(function () {
     317        var element = define_new_custom_element(['style']);
     318        var instance = document.createElement(element.name);
     319        instance.setAttribute('style', 'color: red; display: none;');
     320        assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
     321        testFunction(instance, 'color', 'color');
     322        assert_equals(instance.getAttribute('style'), 'display: none;'); // Don't make this empty since browser behaviors are inconsistent now.
     323        var logEntries = element.takeLog();
     324        assert_array_equals(logEntries.types(), ['attributeChanged']);
     325        assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: 'color: red; display: none;', newValue: 'display: none;', namespace: null});
     326    }, name + ' must enqueue an attributeChanged reaction when it removes a property from the observed style attribute');
     327
     328    test(function () {
     329        var element = define_new_custom_element(['class']);
     330        var instance = document.createElement(element.name);
     331        instance.setAttribute('style', 'color: red; display: none;');
     332        assert_array_equals(element.takeLog().types(), ['constructed']);
     333        testFunction(instance, 'color', 'color');
     334        assert_equals(instance.getAttribute('style'), 'display: none;'); // Don't make this empty since browser behaviors are inconsistent now.
     335        assert_array_equals(element.takeLog().types(), []);
     336    }, name + ' must not enqueue an attributeChanged reaction when it removes a property from the style attribute but the style attribute is not observed');
     337}
     338
     339function test_mutating_style_property_priority(testFunction, name) {
     340    test(function () {
     341        var element = define_new_custom_element(['style']);
     342        var instance = document.createElement(element.name);
     343        instance.setAttribute('style', 'color: red');
     344        assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
     345        testFunction(instance, 'color', 'color', true);
     346        assert_equals(instance.getAttribute('style'), 'color: red !important;');
     347        var logEntries = element.takeLog();
     348        assert_array_equals(logEntries.types(), ['attributeChanged']);
     349        assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: 'color: red', newValue: 'color: red !important;', namespace: null});
     350    }, name + ' must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed');
     351
     352    test(function () {
     353        var element = define_new_custom_element(['id']);
     354        var instance = document.createElement(element.name);
     355        instance.setAttribute('style', 'color: red');
     356        assert_array_equals(element.takeLog().types(), ['constructed']);
     357        testFunction(instance, 'color', 'color', true);
     358        assert_equals(instance.getAttribute('style'), 'color: red !important;');
     359        assert_array_equals(element.takeLog().types(), []);
     360    }, name + ' must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed');
     361}
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/w3c-import.log

    r207520 r208360  
    1717List of files:
    1818/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Attr.html
     19/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration.html
    1920/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ChildNode.html
    2021/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMStringMap.html
     
    2324/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Element.html
    2425/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ElementContentEditable.html
     26/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement.html
    2527/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLElement.html
     28/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement.html
     29/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection.html
     30/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement.html
     31/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement.html
     32/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement.html
     33/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement.html
     34/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement.html
     35/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement.html
    2636/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/NamedNodeMap.html
    2737/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Node.html
     
    2939/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range.html
    3040/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Selection.html
     41/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot.html
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js

    r207520 r208360  
    1717    return create_window_in_test(t, srcdoc)
    1818    .then((w) => {
    19       f(w);
     19      f(w, w.document);
    2020    });
    2121  }, name);
     22}
     23
     24function define_custom_element_in_window(window, name, observedAttributes) {
     25    let log = [];
     26
     27    class CustomElement extends window.HTMLElement {
     28        constructor() {
     29            super();
     30            log.push(create_constructor_log(this));
     31        }
     32        attributeChangedCallback(...args) {
     33            log.push(create_attribute_changed_callback_log(this, ...args));
     34        }
     35        connectedCallback() { log.push(create_connected_callback_log(this)); }
     36        disconnectedCallback() { log.push(create_disconnected_callback_log(this)); }
     37        adoptedCallback(oldDocument, newDocument) { log.push({type: 'adopted', element: this, oldDocument: oldDocument, newDocument: newDocument}); }
     38    }
     39    CustomElement.observedAttributes = observedAttributes;
     40
     41    window.customElements.define(name, CustomElement);
     42
     43    return {
     44        name: name,
     45        class: CustomElement,
     46        takeLog: function () {
     47            let currentLog = log; log = [];
     48            currentLog.types = () => currentLog.map((entry) => entry.type);
     49            currentLog.last = () => currentLog[currentLog.length - 1];
     50            return currentLog;
     51        }
     52    };
     53}
     54
     55function create_constructor_log(element) {
     56    return {type: 'constructed', element: element};
     57}
     58
     59function assert_constructor_log_entry(log, element) {
     60    assert_equals(log.type, 'constructed');
     61    assert_equals(log.element, element);
     62}
     63
     64function create_connected_callback_log(element) {
     65    return {type: 'connected', element: element};
     66}
     67
     68function assert_connected_log_entry(log, element) {
     69    assert_equals(log.type, 'connected');
     70    assert_equals(log.element, element);
     71}
     72
     73function create_disconnected_callback_log(element) {
     74    return {type: 'disconnected', element: element};
     75}
     76
     77function assert_disconnected_log_entry(log, element) {
     78    assert_equals(log.type, 'disconnected');
     79    assert_equals(log.element, element);
     80}
     81
     82function assert_adopted_log_entry(log, element) {
     83    assert_equals(log.type, 'adopted');
     84    assert_equals(log.element, element);
     85}
     86
     87function create_adopted_callback_log(element) {
     88    return {type: 'adopted', element: element};
    2289}
    2390
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions-expected.txt

    r208359 r208360  
    1 CONSOLE MESSAGE: line 140: Exception thrown as a part of test
     1CONSOLE MESSAGE: line 139: Exception thrown as a part of test
    22
    33PASS Upgrading a custom element must enqueue attributeChangedCallback on each attribute
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions.html

    r208359 r208360  
    22<html>
    33<head>
    4 <title>Custom Elements: CEReactions on Attr interface</title>
     4<title>Custom Elements: Upgrading custom elements should enqueue attributeChanged and connected callbacks</title>
    55<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
    6 <meta name="assert" content="value of Attr interface must have CEReactions">
    7 <meta name="help" content="https://dom.spec.whatwg.org/#node">
    8 <script src="../../resources/testharness.js"></script>
    9 <script src="../../resources/testharnessreport.js"></script>
    10 <script src="../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
    11 <script src="resources/additional-helpers.js"></script>
     6<meta name="assert" content="Upgrading custom elements should enqueue attributeChanged and connected callbacksml">
     7<meta name="help" content="https://html.spec.whatwg.org/#upgrades">
     8<script src="/resources/testharness.js"></script>
     9<script src="/resources/testharnessreport.js"></script>
     10<script src="../resources/custom-elements-helpers.js"></script>
    1211</head>
    1312<body>
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log

    r207703 r208360  
    1717List of files:
    1818/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode.html
     19/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions.html
    1920/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element.html
  • trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/w3c-import.log

    r207703 r208360  
    2323/LayoutTests/imported/w3c/web-platform-tests/custom-elements/attribute-changed-callback.html
    2424/LayoutTests/imported/w3c/web-platform-tests/custom-elements/connected-callbacks.html
     25/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue.html
    2526/LayoutTests/imported/w3c/web-platform-tests/custom-elements/disconnected-callbacks.html
    2627/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reaction-timing.html
Note: See TracChangeset for help on using the changeset viewer.