Title: [207520] trunk/LayoutTests
Revision
207520
Author
rn...@webkit.org
Date
2016-10-18 22:03:11 -0700 (Tue, 18 Oct 2016)

Log Message

Import the latest custom elements tests from W3C
https://bugs.webkit.org/show_bug.cgi?id=163640

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

Import more custom elements tests from web-platform-tests as of fbe5ac0fd8eecac67d1562032eeba5bd7ec2b735.
Most of these tests are written and fixed by me.

* web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt:
* web-platform-tests/custom-elements/htmlconstructor/newtarget.html:
* web-platform-tests/custom-elements/reactions/DOMStringMap-expected.txt: Added.
* web-platform-tests/custom-elements/reactions/DOMStringMap.html: Added.
* web-platform-tests/custom-elements/reactions/Document-expected.txt:
* web-platform-tests/custom-elements/reactions/Document.html:
* web-platform-tests/custom-elements/reactions/Element-expected.txt:
* web-platform-tests/custom-elements/reactions/Element.html:
* web-platform-tests/custom-elements/reactions/ElementContentEditable-expected.txt: Added.
* web-platform-tests/custom-elements/reactions/ElementContentEditable.html: Added.
* web-platform-tests/custom-elements/reactions/HTMLElement-expected.txt: Added.
* web-platform-tests/custom-elements/reactions/HTMLElement.html: Added.
* web-platform-tests/custom-elements/reactions/NamedNodeMap-expected.txt:
* web-platform-tests/custom-elements/reactions/NamedNodeMap.html:
* web-platform-tests/custom-elements/reactions/Range-expected.txt:
* web-platform-tests/custom-elements/reactions/Range.html:
* web-platform-tests/custom-elements/reactions/Selection-expected.txt: Added.
* web-platform-tests/custom-elements/reactions/Selection.html: Added.
* 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:

LayoutTests:

Removed the test re-imported via web-platform-tests in r206838.

* fast/custom-elements/lifecycle-callback-timing-expected.txt: Removed.
* fast/custom-elements/lifecycle-callback-timing.html: Removed.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (207519 => 207520)


--- trunk/LayoutTests/ChangeLog	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/ChangeLog	2016-10-19 05:03:11 UTC (rev 207520)
@@ -1,3 +1,15 @@
+2016-10-18  Ryosuke Niwa  <rn...@webkit.org>
+
+        Import the latest custom elements tests from W3C
+        https://bugs.webkit.org/show_bug.cgi?id=163640
+
+        Reviewed by Chris Dumez.
+
+        Removed the test re-imported via web-platform-tests in r206838.
+
+        * fast/custom-elements/lifecycle-callback-timing-expected.txt: Removed.
+        * fast/custom-elements/lifecycle-callback-timing.html: Removed.
+
 2016-10-18  Chris Dumez  <cdu...@apple.com>
 
         [Web IDL] Drop webkit-specific extended attributes that are no longer useful

Deleted: trunk/LayoutTests/fast/custom-elements/lifecycle-callback-timing-expected.txt (207519 => 207520)


--- trunk/LayoutTests/fast/custom-elements/lifecycle-callback-timing-expected.txt	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/fast/custom-elements/lifecycle-callback-timing-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -1,4 +0,0 @@
-
-PASS setAttribute and removeAttribute must enqueue and invoke attributeChangedCallback 
-PASS Calling Node.prototype.cloneNode(false) must push a new element queue to the processing stack 
-

Deleted: trunk/LayoutTests/fast/custom-elements/lifecycle-callback-timing.html (207519 => 207520)


--- trunk/LayoutTests/fast/custom-elements/lifecycle-callback-timing.html	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/fast/custom-elements/lifecycle-callback-timing.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<title>Custom Elements: Lifecycle callback must be invoked before returning to author scripts</title>
-<meta name="author" title="Ryosuke Niwa" href=""
-<meta name="assert" content="Lifecycle callbacks must be invoked before returning to author scripts">
-<link rel="help" href=""
-<script src=""
-<script src=""
-<link rel='stylesheet' href=''>
-</head>
-<body>
-<div id="log"></div>
-<script>
-
-class MyCustomElement extends HTMLElement {
-    attributeChangedCallback(...args) {
-        this.handler(...args);
-    }
-
-    handler() { }
-}
-MyCustomElement.observedAttributes = ['data-title', 'title'];
-customElements.define('my-custom-element', MyCustomElement);
-
-test(function () {
-    var instance = document.createElement('my-custom-element');
-    var anotherInstance = document.createElement('my-custom-element');
-
-    var callbackOrder = [];
-    instance.handler = function () {
-        callbackOrder.push([this, 'begin']);
-        anotherInstance.setAttribute('data-title', 'baz');
-        callbackOrder.push([this, 'end']);
-    }
-    anotherInstance.handler = function () {
-        callbackOrder.push([this, 'begin']);
-        callbackOrder.push([this, 'end']);
-    }
-
-    instance.setAttribute('title', 'foo');
-    assert_equals(callbackOrder.length, 4);
-
-    assert_array_equals(callbackOrder[0], [instance, 'begin']);
-    assert_array_equals(callbackOrder[1], [anotherInstance, 'begin']);
-    assert_array_equals(callbackOrder[2], [anotherInstance, 'end']);
-    assert_array_equals(callbackOrder[3], [instance, 'end']);
-
-}, 'setAttribute and removeAttribute must enqueue and invoke attributeChangedCallback');
-
-test(function () {
-    var shouldCloneAnotherInstance = false;
-    var anotherInstanceClone;
-    var log = [];
-
-    class SelfCloningElement extends HTMLElement {
-        constructor() {
-            super();
-            log.push([this, 'begin']);
-            if (shouldCloneAnotherInstance) {
-                shouldCloneAnotherInstance = false;
-                anotherInstanceClone = anotherInstance.cloneNode(false);
-            }
-            log.push([this, 'end']);
-        }
-    }
-    customElements.define('self-cloning-element', SelfCloningElement);
-
-    var instance = document.createElement('self-cloning-element');
-    var anotherInstance = document.createElement('self-cloning-element');
-    shouldCloneAnotherInstance = true;
-
-    assert_equals(log.length, 4);
-    var instanceClone = instance.cloneNode(false);
-
-    assert_equals(log.length, 8);
-    assert_array_equals(log[0], [instance, 'begin']);
-    assert_array_equals(log[1], [instance, 'end']);
-    assert_array_equals(log[2], [anotherInstance, 'begin']);
-    assert_array_equals(log[3], [anotherInstance, 'end']);
-    assert_array_equals(log[4], [instanceClone, 'begin']);
-    assert_array_equals(log[5], [anotherInstanceClone, 'begin']);
-    assert_array_equals(log[6], [anotherInstanceClone, 'end']);
-    assert_array_equals(log[7], [instanceClone, 'end']);
-}, 'Calling Node.prototype.cloneNode(false) must push a new element queue to the processing stack');
-
-</script>
-</body>
-</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-10-19 05:03:11 UTC (rev 207520)
@@ -1,3 +1,35 @@
+2016-10-18  Ryosuke Niwa  <rn...@webkit.org>
+
+        Import the latest custom elements tests from W3C
+        https://bugs.webkit.org/show_bug.cgi?id=163640
+
+        Reviewed by Chris Dumez.
+
+        Import more custom elements tests from web-platform-tests as of fbe5ac0fd8eecac67d1562032eeba5bd7ec2b735.
+        Most of these tests are written and fixed by me.
+
+        * web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt:
+        * web-platform-tests/custom-elements/htmlconstructor/newtarget.html:
+        * web-platform-tests/custom-elements/reactions/DOMStringMap-expected.txt: Added.
+        * web-platform-tests/custom-elements/reactions/DOMStringMap.html: Added.
+        * web-platform-tests/custom-elements/reactions/Document-expected.txt:
+        * web-platform-tests/custom-elements/reactions/Document.html:
+        * web-platform-tests/custom-elements/reactions/Element-expected.txt:
+        * web-platform-tests/custom-elements/reactions/Element.html:
+        * web-platform-tests/custom-elements/reactions/ElementContentEditable-expected.txt: Added.
+        * web-platform-tests/custom-elements/reactions/ElementContentEditable.html: Added.
+        * web-platform-tests/custom-elements/reactions/HTMLElement-expected.txt: Added.
+        * web-platform-tests/custom-elements/reactions/HTMLElement.html: Added.
+        * web-platform-tests/custom-elements/reactions/NamedNodeMap-expected.txt:
+        * web-platform-tests/custom-elements/reactions/NamedNodeMap.html:
+        * web-platform-tests/custom-elements/reactions/Range-expected.txt:
+        * web-platform-tests/custom-elements/reactions/Range.html:
+        * web-platform-tests/custom-elements/reactions/Selection-expected.txt: Added.
+        * web-platform-tests/custom-elements/reactions/Selection.html: Added.
+        * 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:
+
 2016-10-18  Chris Dumez  <cdu...@apple.com>
 
         Changing details.open should cause a toggle event to be fired asynchronously

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -1,7 +1,12 @@
 
-FAIL Use NewTarget's prototype, not the one stored at definition time promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'document.bo..."
-FAIL Rethrow any exceptions thrown while getting the prototype assert_throws: function "() => {
-      return Reflect.construct(w.HTMLElement, [],..." threw object "TypeError: new.target does not define a custom element" ("TypeError") expected object "[object Object]" ("prototype throws")
-FAIL If prototype is not object, derives the fallback from NewTarget's realm (autonomous custom elements) promise_test: Unhandled rejection with value: object "TypeError: new.target does not define a custom element"
-FAIL If prototype is not object, derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument ..."
+PASS Use NewTarget's prototype, not the one stored at definition time 
+PASS Rethrow any exceptions thrown while getting the prototype 
+FAIL If prototype is not object (null), derives the fallback from NewTarget's realm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]"
+FAIL If prototype is not object (undefined), derives the fallback from NewTarget's realm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]"
+FAIL If prototype is not object (5), derives the fallback from NewTarget's realm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]"
+FAIL If prototype is not object (string), derives the fallback from NewTarget's realm (autonomous custom elements) assert_equals: Must use the HTMLElement from the realm of NewTarget expected object "[object HTMLElementPrototype]" but got object "[object HTMLElementPrototype]"
+FAIL If prototype is not object (null), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument ..."
+FAIL If prototype is not object (undefined), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument ..."
+FAIL If prototype is not object (5), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument ..."
+FAIL If prototype is not object (string), derives the fallback from NewTarget's realm (customized built-in elements) promise_test: Unhandled rejection with value: object "TypeError: Reflect.construct requires the first argument ..."
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -5,37 +5,35 @@
 <script src=""
 <script src=""
 <script src=""
-
+<body>
 <script>
 "use strict";
 
 test_with_window(w => {
-  let afterDefinition = false;
+  let beforeDefinition = true;
   const proto1 = { "proto": "number one" };
   const proto2 = { "proto": "number two" };
 
-  const TestElement = (function () {
-    assert_throws({ name: "prototype throws" }, () => {
-      const o = Reflect.construct(w.HTMLElement, [], new.target);
+  function TestElement() {
+    const o = Reflect.construct(w.HTMLElement, [], new.target);
+    assert_equals(Object.getPrototypeOf(o), proto2,
+      "Must use the value returned from new.target.prototype");
+    assert_not_equals(Object.getPrototypeOf(o), proto1,
+      "Must not use the prototype stored at definition time");
+  }
 
-      assert_equals(Object.getPrototypeOf(o), proto2,
-        "Must use the value returned from new.target.prototype");
-      assert_not_equals(Object.getPrototypeOf(o), proto1,
-        "Must not use the prototype stored at definition time");
-    });
-  }).bind({});
-
-  Object.defineProperty(TestElement, "prototype", {
-    get() {
-      return beforeDefinition ? proto1 : proto2;
-    }
+  const ElementWithDynamicPrototype = new Proxy(TestElement, {
+      get: function (target, name) {
+        if (name == "prototype")
+          return beforeDefinition ? proto1 : proto2;
+        return target[name];
+      }
   });
 
-  w.customElements.define("test-element", TestElement);
+  w.customElements.define("test-element", ElementWithDynamicPrototype);
 
-  beforeDefinition = true;
-  new TestElement();
-
+  beforeDefinition = false;
+  new ElementWithDynamicPrototype();
 }, "Use NewTarget's prototype, not the one stored at definition time");
 
 test_with_window(w => {
@@ -42,63 +40,65 @@
   // We have to not throw during define(), but throw during super()
   let throws = false;
 
-  const TestElement = (function () {
+  function TestElement() {
+    throws = true;
     assert_throws({ name: "prototype throws" }, () => {
-      return Reflect.construct(w.HTMLElement, [], new.target);
+      Reflect.construct(w.HTMLElement, [], new.target);
     });
-  }).bind({});
+  }
 
-  Object.defineProperty(TestElement, "prototype", {
-    get() {
-      if (throws) {
+  const ElementWithDynamicPrototype = new Proxy(TestElement, {
+    get: function (target, name) {
+      if (throws && name == "prototype")
         throw { name: "prototype throws" };
-      }
-      return {};
+      return target[name];
     }
   });
 
-  w.customElements.define("test-element", TestElement);
+  w.customElements.define("test-element", ElementWithDynamicPrototype);
 
-  throws = true;
-  new TestElement();
+  new ElementWithDynamicPrototype();
 
 }, "Rethrow any exceptions thrown while getting the prototype");
 
-test_with_window(w => {
-  for (const notAnObject of [null, undefined, 5, "string"]) {
+[null, undefined, 5, "string"].forEach(function (notAnObject) {
+  test_with_window(w => {
     // We have to return an object during define(), but not during super()
     let returnNotAnObject = false;
 
-    const TestElement = (function () {
+    function TestElement() {
       const o = Reflect.construct(w.HTMLElement, [], new.target);
 
-      assert_equals(Object.getPrototypeOf(o), window.HTMLElement,
+      assert_equals(Object.getPrototypeOf(new.target), window.Function.prototype);
+      assert_equals(Object.getPrototypeOf(o), window.HTMLElement.prototype,
         "Must use the HTMLElement from the realm of NewTarget");
-      assert_not_equals(Object.getPrototypeOf(o), w.HTMLElement,
+      assert_not_equals(Object.getPrototypeOf(o), w.HTMLElement.prototype,
         "Must not use the HTMLElement from the realm of the active function object (w.HTMLElement)");
 
       return o;
-    }).bind({});
+    }
 
-    Object.defineProperty(TestElement, "prototype", {
-      get() {
-        return returnNotAnObject ? notAnObject : {};
+    const ElementWithDynamicPrototype = new Proxy(TestElement, {
+      get: function (target, name) {
+        if (name == "prototype")
+          return returnNotAnObject ? notAnObject : {};
+        return target[name];
       }
     });
 
-    w.customElements.define("test-element", TestElement);
+    w.customElements.define("test-element", ElementWithDynamicPrototype);
 
     returnNotAnObject = true;
-    new TestElement();
-  }
-}, "If prototype is not object, derives the fallback from NewTarget's realm (autonomous custom elements)");
+    new ElementWithDynamicPrototype();
+  }, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's realm (autonomous custom elements)");
+});
 
-test_with_window(w => {
-  for (const notAnObject of [null, undefined, 5, "string"]) {
+[null, undefined, 5, "string"].forEach(function (notAnObject) {
+  test_with_window(w => {
     // We have to return an object during define(), but not during super()
     let returnNotAnObject = false;
 
-    const TestElement = (function () {
+    function TestElement() {
       const o = Reflect.construct(w.HTMLParagraphElement, [], new.target);
 
       assert_equals(Object.getPrototypeOf(o), window.HTMLParagraphElement,
@@ -107,18 +107,22 @@
         "Must not use the HTMLParagraphElement from the realm of the active function object (w.HTMLParagraphElement)");
 
       return o;
-    }).bind({});
+    }
 
-    Object.defineProperty(TestElement, "prototype", {
-      get() {
-        return returnNotAnObject ? notAnObject : {};
+    const ElementWithDynamicPrototype = new Proxy(TestElement, {
+      get: function (target, name) {
+        if (name == "prototype")
+          return returnNotAnObject ? notAnObject : {};
+        return target[name];
       }
     });
 
-    w.customElements.define("test-element", TestElement, { extends: "p" });
+    w.customElements.define("test-element", ElementWithDynamicPrototype, { extends: "p" });
 
     returnNotAnObject = true;
-    new TestElement();
-  }
-}, "If prototype is not object, derives the fallback from NewTarget's realm (customized built-in elements)");
+    new ElementWithDynamicPrototype();
+  }, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's realm (customized built-in elements)");
+});
+
 </script>
+</body>
\ No newline at end of file

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMStringMap-expected.txt (0 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMStringMap-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMStringMap-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -0,0 +1,10 @@
+
+FAIL setter on DOMStringMap must enqueue an attributeChanged reaction when adding an observed data attribute assert_array_equals: lengths differ, expected 1 got 0
+PASS setter on DOMStringMap must not enqueue an attributeChanged reaction when adding an unobserved data attribute 
+FAIL setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute to the same value assert_array_equals: lengths differ, expected 2 got 1
+PASS setter on DOMStringMap must not enqueue an attributeChanged reaction when mutating the value of an unobserved data attribute 
+FAIL deleter on DOMStringMap must enqueue an attributeChanged reaction when removing an observed data attribute assert_array_equals: lengths differ, expected 2 got 1
+PASS deleter on DOMStringMap must not enqueue an attributeChanged reaction when removing an unobserved data attribute 
+PASS deleter on DOMStringMap must not enqueue an attributeChanged reaction when it does not remove a data attribute 
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMStringMap.html (0 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMStringMap.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMStringMap.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -0,0 +1,96 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on DOMStringMap interface</title>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content="setter and deleter of DOMStringMap interface must have CEReactions">
+<meta name="help" content="https://html.spec.whatwg.org/#domstringmap">
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test(function () {
+    var element = define_new_custom_element(['data-foo']);
+    var instance = document.createElement(element.name);
+    assert_array_equals(element.takeLog().types(), ['constructed']);
+    instance.dataset.foo = 'bar';
+    var logEntries = element.takeLog();
+    assert_array_equals(logEntries.types(), ['attributeChanged']);
+    assert_attribute_log_entry(logEntries.last(), {name: 'data-foo', oldValue: null, newValue: 'bar', namespace: null});
+}, 'setter on DOMStringMap must enqueue an attributeChanged reaction when adding an observed data attribute');
+
+test(function () {
+    var element = define_new_custom_element(['data-bar']);
+    var instance = document.createElement(element.name);
+    assert_array_equals(element.takeLog().types(), ['constructed']);
+    instance.dataset.foo = 'bar';
+    assert_array_equals(element.takeLog().types(), []);
+}, 'setter on DOMStringMap must not enqueue an attributeChanged reaction when adding an unobserved data attribute');
+
+test(function () {
+    var element = define_new_custom_element(['data-foo']);
+    var instance = document.createElement(element.name);
+    instance.dataset.foo = 'bar';
+    assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
+    instance.dataset.foo = 'baz';
+    var logEntries = element.takeLog();
+    assert_array_equals(logEntries.types(), ['attributeChanged']);
+    assert_attribute_log_entry(logEntries.last(), {name: 'data-foo', oldValue: 'bar', newValue: 'baz', namespace: null});
+}, 'setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute');
+
+test(function () {
+    var element = define_new_custom_element(['data-foo']);
+    var instance = document.createElement(element.name);
+    instance.dataset.foo = 'bar';
+    assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
+    instance.dataset.foo = 'bar';
+    var logEntries = element.takeLog();
+    assert_array_equals(logEntries.types(), ['attributeChanged']);
+    assert_attribute_log_entry(logEntries.last(), {name: 'data-foo', oldValue: 'bar', newValue: 'bar', namespace: null});
+}, 'setter on DOMStringMap must enqueue an attributeChanged reaction when mutating the value of an observed data attribute to the same value');
+
+test(function () {
+    var element = define_new_custom_element(['data-zero']);
+    var instance = document.createElement(element.name);
+    instance.dataset.foo = 'bar';
+    assert_array_equals(element.takeLog().types(), ['constructed']);
+    instance.dataset.foo = 'baz';
+    assert_array_equals(element.takeLog().types(), []);
+}, 'setter on DOMStringMap must not enqueue an attributeChanged reaction when mutating the value of an unobserved data attribute');
+
+test(function () {
+    var element = define_new_custom_element(['data-foo']);
+    var instance = document.createElement(element.name);
+    instance.dataset.foo = 'bar';
+    assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
+    delete instance.dataset.foo;
+    var logEntries = element.takeLog();
+    assert_array_equals(logEntries.types(), ['attributeChanged']);
+    assert_attribute_log_entry(logEntries.last(), {name: 'data-foo', oldValue: 'bar', newValue: null, namespace: null});
+}, 'deleter on DOMStringMap must enqueue an attributeChanged reaction when removing an observed data attribute');
+
+test(function () {
+    var element = define_new_custom_element(['data-bar']);
+    var instance = document.createElement(element.name);
+    instance.dataset.foo = 'bar';
+    assert_array_equals(element.takeLog().types(), ['constructed']);
+    delete instance.dataset.foo;
+    assert_array_equals(element.takeLog().types(), []);
+}, 'deleter on DOMStringMap must not enqueue an attributeChanged reaction when removing an unobserved data attribute');
+
+test(function () {
+    var element = define_new_custom_element(['data-foo']);
+    var instance = document.createElement(element.name);
+    assert_array_equals(element.takeLog().types(), ['constructed']);
+    delete instance.dataset.foo;
+    assert_array_equals(element.takeLog().types(), []);
+}, 'deleter on DOMStringMap must not enqueue an attributeChanged reaction when it does not remove a data attribute');
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -1,4 +1,5 @@
 
 FAIL importNode on Document must construct a new custom element when importing a custom element assert_array_equals: lengths differ, expected 1 got 0
 PASS adoptNode on Document must enqueue an adopted reaction when importing a custom element 
+FAIL execCommand on Document must enqueue a disconnected reaction when deleting a custom element from a contenteditable element assert_array_equals: lengths differ, expected 1 got 0
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<title>Custom Elements: CEReactions on ParentNode interface</title>
+<title>Custom Elements: CEReactions on Document interface</title>
 <meta name="author" title="Ryosuke Niwa" href=""
 <meta name="assert" content="importNode and adoptNode of Document interface must have CEReactions">
 <meta name="help" content="https://dom.spec.whatwg.org/#document">
+<meta name="help" content="https://html.spec.whatwg.org/#document">
 <script src=""
 <script src=""
 <script src=""
@@ -42,6 +43,23 @@
     assert_equals(logEntries.last().newDocument, newDoc);
 }, 'adoptNode on Document must enqueue an adopted reaction when importing a custom element');
 
+test(function () {
+    var element = define_new_custom_element();
+    var instance = document.createElement(element.name);
+
+    var container = document.createElement('div');
+    container.contentEditable = true;
+    container.appendChild(instance);
+    document.body.appendChild(container);
+
+    assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+
+    container.focus();
+    document.execCommand('delete', false, null);
+
+    assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'execCommand on Document must enqueue a disconnected reaction when deleting a custom element from a contenteditable element');
+
 </script>
 </body>
 </html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Element-expected.txt (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Element-expected.txt	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Element-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -13,11 +13,9 @@
 PASS setAttributeNS on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute 
 PASS setAttributeNS on Element must enqueue an attributeChanged reaction when replacing an existing attribute 
 PASS setAttributeNS on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute 
-PASS removeAttribute on Element must not enqueue an attributeChanged reaction when removing an attribute that does not exist 
 PASS removeAttribute on Element must not enqueue an attributeChanged reaction when removing an unobserved attribute 
 PASS removeAttribute on Element must enqueue an attributeChanged reaction when removing an existing attribute 
 PASS removeAttribute on Element must not enqueue an attributeChanged reaction when removing an existing unobserved attribute 
-PASS removeAttributeNS on Element must not enqueue an attributeChanged reaction when removing an attribute that does not exist 
 PASS removeAttributeNS on Element must not enqueue an attributeChanged reaction when removing an unobserved attribute 
 PASS removeAttributeNS on Element must enqueue an attributeChanged reaction when removing an existing attribute 
 PASS removeAttributeNS on Element must not enqueue an attributeChanged reaction when removing an existing unobserved attribute 
@@ -29,10 +27,17 @@
 PASS setAttributeNodeNS on Element must not enqueue an attributeChanged reaction when adding an unobserved attribute 
 PASS setAttributeNodeNS on Element must enqueue an attributeChanged reaction when replacing an existing attribute 
 PASS setAttributeNodeNS on Element must enqueue an attributeChanged reaction when replacing an existing unobserved attribute 
-PASS removeAttributeNode on Element must not enqueue an attributeChanged reaction when removing an attribute that does not exist 
 PASS removeAttributeNode on Element must not enqueue an attributeChanged reaction when removing an unobserved attribute 
 PASS removeAttributeNode on Element must enqueue an attributeChanged reaction when removing an existing attribute 
 PASS removeAttributeNode on Element must not enqueue an attributeChanged reaction when removing an existing unobserved attribute 
-PASS undefined must enqueue a connected reaction 
-PASS undefined must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document 
+PASS insertAdjacentElement on Element must enqueue a connected reaction 
+PASS insertAdjacentElement on Element must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document 
+FAIL innerHTML on Element must enqueue a connected reaction for a newly constructed custom element assert_array_equals: lengths differ, expected 2 got 1
+FAIL innerHTML on Element must enqueue a attributeChanged reaction for a newly constructed custom element assert_array_equals: lengths differ, expected 3 got 1
+FAIL innerHTML on Element must enqueue a disconnected reaction assert_array_equals: lengths differ, expected 1 got 0
+FAIL outerHTML on Element must enqueue a connected reaction for a newly constructed custom element assert_array_equals: lengths differ, expected 2 got 1
+FAIL outerHTML on Element must enqueue a attributeChanged reaction for a newly constructed custom element assert_array_equals: lengths differ, expected 3 got 1
+FAIL outerHTML on Element must enqueue a disconnected reaction assert_array_equals: lengths differ, expected 1 got 0
+FAIL insertAdjacentHTML on Element must enqueue a connected reaction for a newly constructed custom element assert_array_equals: lengths differ, expected 2 got 1
+FAIL insertAdjacentHTML on Element must enqueue a attributeChanged reaction for a newly constructed custom element assert_array_equals: lengths differ, expected 3 got 1
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Element.html (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Element.html	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Element.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -1,10 +1,11 @@
 <!DOCTYPE html>
 <html>
 <head>
-<title>Custom Elements: CEReactions on Node interface</title>
+<title>Custom Elements: CEReactions on Element interface</title>
 <meta name="author" title="Ryosuke Niwa" href=""
-<meta name="assert" content="id, className, slot, setAttribute, setAttributeNS, removeAttribute, removeAttributeNS, setAttributeNode, setAttributeNodeNS, removeAttributeNode, and insertAdjacentElement of Element interface must have CEReactions">
+<meta name="assert" content="id, className, slot, setAttribute, setAttributeNS, removeAttribute, removeAttributeNS, setAttributeNode, setAttributeNodeNS, removeAttributeNode, insertAdjacentElement, innerHTML, outerHTML, and insertAdjacentHTML of Element interface must have CEReactions">
 <meta name="help" content="https://dom.spec.whatwg.org/#element">
+<meta name="help" content="https://w3c.github.io/DOM-Parsing/">
 <script src=""
 <script src=""
 <script src=""
@@ -54,8 +55,28 @@
 
 testNodeConnector(function (newContainer, element) {
     newContainer.insertAdjacentElement('afterBegin', element);
-});
+}, 'insertAdjacentElement on Element');
 
+testInsertingMarkup(function (newContainer, markup) {
+    newContainer.innerHTML = markup;
+}, 'innerHTML on Element');
+
+testNodeDisconnector(function (customElement) {
+    customElement.parentNode.innerHTML = '';
+}, 'innerHTML on Element');
+
+testInsertingMarkup(function (newContainer, markup) {
+    newContainer.firstChild.outerHTML = markup;
+}, 'outerHTML on Element');
+
+testNodeDisconnector(function (customElement) {
+    customElement.outerHTML = '';
+}, 'outerHTML on Element');
+
+testInsertingMarkup(function (newContainer, markup) {
+    newContainer.insertAdjacentHTML('afterBegin', markup);
+}, 'insertAdjacentHTML on Element');
+
 </script>
 </body>
 </html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ElementContentEditable-expected.txt (0 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ElementContentEditable-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ElementContentEditable-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -0,0 +1,4 @@
+
+FAIL contentEditable on ElementContentEditable must enqueue an attributeChanged reaction when adding contenteditable content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL contentEditable on ElementContentEditable must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ElementContentEditable.html (0 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ElementContentEditable.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ElementContentEditable.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on ElementContentEditable interface</title>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content="contentEditable of ElementContentEditable interface must have CEReactions">
+<meta name="help" content="https://html.spec.whatwg.org/#elementcontenteditable">
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+testReflectAttribute('contentEditable', 'contenteditable', 'true', 'false', 'contentEditable on ElementContentEditable');
+
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLElement-expected.txt (0 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLElement-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLElement-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -0,0 +1,26 @@
+
+FAIL title on HTMLElement must enqueue an attributeChanged reaction when adding title content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL title on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL lang on HTMLElement must enqueue an attributeChanged reaction when adding lang content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL lang on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL translate on HTMLElement must enqueue an attributeChanged reaction when adding translate content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL translate on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL dir on HTMLElement must enqueue an attributeChanged reaction when adding dir content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL dir on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL hidden on HTMLElement must enqueue an attributeChanged reaction when adding hidden content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL hidden on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL tabIndex on HTMLElement must enqueue an attributeChanged reaction when adding tabindex content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL tabIndex on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL accessKey on HTMLElement must enqueue an attributeChanged reaction when adding accesskey content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL accessKey on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL draggable on HTMLElement must enqueue an attributeChanged reaction when adding draggable content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL draggable on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL dropzone on HTMLElement must enqueue an attributeChanged reaction when adding dropzone content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL dropzone on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL contextMenu on HTMLElement must enqueue an attributeChanged reaction when adding contextmenu content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL contextMenu on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL spellcheck on HTMLElement must enqueue an attributeChanged reaction when adding spellcheck content attribute assert_array_equals: lengths differ, expected 1 got 0
+FAIL spellcheck on HTMLElement must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 2 got 1
+FAIL innerText on HTMLElement must enqueue a disconnected reaction assert_array_equals: lengths differ, expected 1 got 0
+FAIL outerText on HTMLElement must enqueue a disconnected reaction assert_array_equals: lengths differ, expected 1 got 0
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLElement.html (0 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLElement.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLElement.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLElement interface</title>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content="title, lang, translate, dir, hidden, tabIndex, accessKey, draggable, dropzone, contextMenu, spellcheck, innerText, and outerText of HTMLElement interface must have CEReactions">
+<meta name="help" content="https://html.spec.whatwg.org/#htmlelement">
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+testReflectAttribute('title', 'title', 'foo', 'bar', 'title on HTMLElement');
+testReflectAttribute('lang', 'lang', 'en', 'zh', 'lang on HTMLElement');
+testReflectAttributeWithContentValues('translate', 'translate', true, 'yes', false, 'no', 'translate on HTMLElement');
+testReflectAttribute('dir', 'dir', 'ltr', 'rtl', 'dir on HTMLElement');
+testReflectBooleanAttribute('hidden', 'hidden', 'hidden on HTMLElement');
+testReflectAttribute('tabIndex', 'tabindex', '0', '1', 'tabIndex on HTMLElement');
+testReflectAttribute('accessKey', 'accesskey', 'a', 'b', 'accessKey on HTMLElement');
+testReflectAttributeWithContentValues('draggable', 'draggable', true, 'true', false, 'false', 'draggable on HTMLElement');
+testReflectAttribute('dropzone', 'dropzone', 'copy', 'move', 'dropzone on HTMLElement');
+testReflectAttribute('contextMenu', 'contextmenu', 'menu1', 'menu2', 'contextMenu on HTMLElement');
+testReflectAttributeWithContentValues('spellcheck', 'spellcheck', true, 'true', false, 'false', 'spellcheck on HTMLElement');
+
+testNodeDisconnector(function (customElement) {
+    customElement.parentNode.innerText = '';
+}, 'innerText on HTMLElement');
+
+if ('outerText' in HTMLElement.prototype) {
+    // Not yet to be in the standard but all but Gecko supports this property: https://github.com/whatwg/html/issues/668
+    testNodeDisconnector(function (customElement) {
+        customElement.outerText = '';
+    }, 'outerText on HTMLElement');
+}
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/NamedNodeMap-expected.txt (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/NamedNodeMap-expected.txt	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/NamedNodeMap-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -7,11 +7,9 @@
 PASS setNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when adding an unobserved attribute 
 PASS setNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing attribute 
 PASS setNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when replacing an existing unobserved attribute 
-FAIL removeNamedItem on NamedNodeMap must not enqueue an attributeChanged reaction when removing an attribute that does not exist The object can not be found here.
 PASS removeNamedItem on NamedNodeMap must not enqueue an attributeChanged reaction when removing an unobserved attribute 
 PASS removeNamedItem on NamedNodeMap must enqueue an attributeChanged reaction when removing an existing attribute 
 PASS removeNamedItem on NamedNodeMap must not enqueue an attributeChanged reaction when removing an existing unobserved attribute 
-FAIL removeNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when removing an attribute that does not exist The object can not be found here.
 PASS removeNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when removing an unobserved attribute 
 PASS removeNamedItemNS on NamedNodeMap must enqueue an attributeChanged reaction when removing an existing attribute 
 PASS removeNamedItemNS on NamedNodeMap must not enqueue an attributeChanged reaction when removing an existing unobserved attribute 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/NamedNodeMap.html (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/NamedNodeMap.html	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/NamedNodeMap.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -28,11 +28,11 @@
 
 testAttributeRemover(function (element, name) {
     element.attributes.removeNamedItem(name);
-}, 'removeNamedItem on NamedNodeMap');
+}, 'removeNamedItem on NamedNodeMap', {onlyExistingAttribute: true});
 
 testAttributeRemover(function (element, name) {
     element.attributes.removeNamedItemNS(null, name);
-}, 'removeNamedItemNS on NamedNodeMap');
+}, 'removeNamedItemNS on NamedNodeMap', {onlyExistingAttribute: true});
 
 </script>
 </body>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range-expected.txt (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range-expected.txt	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -6,6 +6,8 @@
 FAIL cloneContents on Range must enqueue an attributeChanged reaction when cloning an element only for observed attributes assert_array_equals: lengths differ, expected 3 got 1
 PASS insertNode on Range must enqueue a connected reaction 
 PASS insertNode on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document 
-PASS insertNode on Range must enqueue a connected reaction 
-PASS insertNode on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document 
+PASS surroundContents on Range must enqueue a connected reaction 
+PASS surroundContents on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document 
+FAIL createContextualFragment on Range must construct a custom element assert_equals: expected (function) function "class CustomElement extends HTMLElement {
+        constru..." but got (object) object "[object Object]"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range.html (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range.html	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -42,8 +42,13 @@
     var range = document.createRange();
     range.selectNodeContents(container);
     range.surroundContents(customElement);
-}, 'insertNode on Range');
+}, 'surroundContents on Range');
 
+testParsingMarkup(function (document, markup) {
+    var range = document.createRange();
+    return range.createContextualFragment(markup);
+}, 'createContextualFragment on Range');
+
 </script>
 </body>
 </html>

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Selection-expected.txt (0 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Selection-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Selection-expected.txt	2016-10-19 05:03:11 UTC (rev 207520)
@@ -0,0 +1,3 @@
+
+FAIL deleteFromDocument on Selection must enqueue a disconnected reaction assert_array_equals: lengths differ, expected 1 got 0
+

Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Selection.html (0 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Selection.html	                        (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Selection.html	2016-10-19 05:03:11 UTC (rev 207520)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on Selection interface</title>
+<meta name="author" title="Ryosuke Niwa" href=""
+<meta name="assert" content="deleteFromDocument of Selection interface must have CEReactions">
+<meta name="help" content="http://w3c.github.io/selection-api/#selection-interface">
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+testNodeDisconnector(function (customElement, window) {
+    let selection = window.getSelection();
+    let parent = customElement.parentNode;
+
+    // WebKit and Blink "normalizes" selection in selectAllChildren and not select the empty customElement.
+    // Workaround this orthogonal non-standard behavior by inserting text nodes around the custom element.
+    parent.prepend(document.createTextNode('start'));
+    parent.append(document.createTextNode('end'));
+
+    selection.selectAllChildren(parent);
+    selection.deleteFromDocument();
+}, 'deleteFromDocument on Selection');
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js	2016-10-19 05:03:11 UTC (rev 207520)
@@ -39,7 +39,7 @@
         assert_array_equals(element.takeLog().types(), ['constructed']);
         container.appendChild(instance);
         assert_array_equals(element.takeLog().types(), ['connected']);
-        testFunction(instance);
+        testFunction(instance, window);
         assert_array_equals(element.takeLog().types(), ['disconnected']);
     }, name + ' must enqueue a disconnected reaction');
 
@@ -46,6 +46,40 @@
     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}></${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"></${element.name}>`);
+        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"></${element.name}>`);
+        assert_equals(Object.getPrototypeOf(instance.querySelector(element.name)), element.class);
+        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'));
@@ -92,7 +126,7 @@
     }, name + ' must enqueue an attributeChanged reaction when cloning an element only for observed attributes');
 }
 
-function testReflectAttribute(jsAttributeName, contentAttributeName, validValue1, validValue2, name) {
+function testReflectAttributeWithContentValues(jsAttributeName, contentAttributeName, validValue1, contentValue1, validValue2, contentValue2, name) {
     test(function () {
         var element = define_new_custom_element([contentAttributeName]);
         var instance = document.createElement(element.name);
@@ -100,7 +134,8 @@
         instance[jsAttributeName] = validValue1;
         var logEntries = element.takeLog();
         assert_array_equals(logEntries.types(), ['attributeChanged']);
-        assert_attribute_log_entry(logEntries.last(), {name: contentAttributeName, oldValue: null, newValue: validValue1, namespace: null});
+
+        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 () {
@@ -111,10 +146,18 @@
         instance[jsAttributeName] = validValue2;
         var logEntries = element.takeLog();
         assert_array_equals(logEntries.types(), ['attributeChanged']);
-        assert_attribute_log_entry(logEntries.last(), {name: contentAttributeName, oldValue: validValue1, newValue: validValue2, namespace: null});
+        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) {
+    testReflectAttributeWithContentValues(jsAttributeName, contentAttributeName, validValue1, validValue1, validValue2, validValue2, name);
+}
+
+function testReflectBooleanAttribute(jsAttributeName, contentAttributeName, name) {
+    testReflectAttributeWithContentValues(jsAttributeName, contentAttributeName, true, '', false, null, name);
+}
+
 function testAttributeAdder(testFunction, name) {
     test(function () {
         var element = define_new_custom_element(['id']);
@@ -177,14 +220,16 @@
     }, name + ' must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute');
 }
 
-function testAttributeRemover(testFunction, name) {
-    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');
+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([]);

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/w3c-import.log (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/w3c-import.log	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/w3c-import.log	2016-10-19 05:03:11 UTC (rev 207520)
@@ -17,10 +17,14 @@
 List of files:
 /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Attr.html
 /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ChildNode.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMStringMap.html
 /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList.html
 /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html
 /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Element.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ElementContentEditable.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLElement.html
 /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/NamedNodeMap.html
 /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Node.html
 /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ParentNode.html
 /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Selection.html

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js (207519 => 207520)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js	2016-10-19 04:46:39 UTC (rev 207519)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js	2016-10-19 05:03:11 UTC (rev 207520)
@@ -65,6 +65,7 @@
 
     return {
         name: name,
+        class: CustomElement,
         takeLog: function () {
             let currentLog = log; log = [];
             currentLog.types = () => currentLog.map((entry) => entry.type);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to