<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[208360] trunk/LayoutTests</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/208360">208360</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-11-03 18:37:01 -0700 (Thu, 03 Nov 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcustomelementsreactionsforwebkitextensionshtml">trunk/LayoutTests/fast/custom-elements/reactions-for-webkit-extensions.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementshtmlconstructornewtargethtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsDocumentexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsDocumenthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsresourcesreactionsjs">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/w3c-import.log</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsresourcescustomelementshelpersjs">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/w3c-import.log</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementscustomelementreactionqueueexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementscustomelementreactionqueuehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsCSSStyleDeclarationexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsCSSStyleDeclarationhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLAnchorElementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLAnchorElementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOptionElementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOptionElementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOptionsCollectionexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOptionsCollectionhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOutputElementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOutputElementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLSelectElementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLSelectElementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableElementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableElementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableRowElementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableRowElementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableSectionElementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableSectionElementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTitleElementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTitleElementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsShadowRootexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsShadowRoothtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingupgradingenqueuereactionsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingupgradingenqueuereactionshtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions.html</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcustomelementscustomelementreactionqueueexpectedtxt">trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcustomelementscustomelementreactionqueuehtml">trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue.html</a></li>
<li>trunk/LayoutTests/fast/custom-elements/reactions/</li>
<li><a href="#trunkLayoutTestsfastcustomelementsresourcesadditionalhelpersjs">trunk/LayoutTests/fast/custom-elements/resources/additional-helpers.js</a></li>
<li><a href="#trunkLayoutTestsfastcustomelementsupgradingenqueuereactionsexpectedtxt">trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcustomelementsupgradingenqueuereactionshtml">trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/ChangeLog        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-11-03 Ryosuke Niwa <rniwa@webkit.org>
+
+ Update custom elements tests
+ https://bugs.webkit.org/show_bug.cgi?id=164352
+
+ Reviewed by Antti Koivisto.
+
+ 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.
+
</ins><span class="cx"> 2016-11-03 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> IndexedDB 2.0: Rename IDBKeyRange.contains to IDBKeyRange.includes.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementscustomelementreactionqueueexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue-expected.txt (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue-expected.txt        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -1,5 +0,0 @@
</span><del>-
-PASS Upgrading a custom element must invoke attributeChangedCallback and connectedCallback before start upgrading another element
-PASS Mutating a undefined custom element while upgrading a custom element must not enqueue or invoke reactions on the mutated element
-PASS Mutating another custom element inside adopted callback must invoke all pending callbacks on the mutated element
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementscustomelementreactionqueuehtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue.html (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue.html        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -1,181 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-<title>Custom Elements: Each element must have its own custom element reaction queue</title>
-<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
-<meta name="assert" content="Each element must have its own custom element reaction queue">
-<meta name="help" content="https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reaction-queue">
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
-</head>
-<body>
-<div id="log"></div>
-<script>
-
-function create_constructor_log(element) {
- return {type: 'constructed', element: element};
-}
-
-function assert_constructor_log_entry(log, element) {
- assert_equals(log.type, 'constructed');
- assert_equals(log.element, element);
-}
-
-function assert_adopted_log_entry(log, element) {
- assert_equals(log.type, 'adopted');
- assert_equals(log.element, element);
-}
-
-function create_adopted_callback_log(element) {
- return {type: 'adopted', element: element};
-}
-
-function create_connected_callback_log(element) {
- return {type: 'connected', element: element};
-}
-
-function assert_connected_log_entry(log, element) {
- assert_equals(log.type, 'connected');
- assert_equals(log.element, element);
-}
-
-test_with_window(function (contentWindow) {
- const contentDocument = contentWindow.document;
- contentDocument.write('<test-element id="first-element">');
- contentDocument.write('<test-element id="second-element">');
-
- const element1 = contentDocument.getElementById('first-element');
- const element2 = contentDocument.getElementById('second-element');
- assert_equals(Object.getPrototypeOf(element1), contentWindow.HTMLElement.prototype);
- assert_equals(Object.getPrototypeOf(element2), contentWindow.HTMLElement.prototype);
-
- let log = [];
- class TestElement extends contentWindow.HTMLElement {
- constructor() {
- super();
- log.push(create_constructor_log(this));
- }
- connectedCallback(...args) {
- log.push(create_connected_callback_log(this, ...args));
- }
- attributeChangedCallback(...args) {
- log.push(create_attribute_changed_callback_log(this, ...args));
- }
- static get observedAttributes() { return ['id']; }
- }
- contentWindow.customElements.define('test-element', TestElement);
- assert_equals(Object.getPrototypeOf(element1), TestElement.prototype);
- assert_equals(Object.getPrototypeOf(element2), TestElement.prototype);
-
- assert_equals(log.length, 6);
- assert_constructor_log_entry(log[0], element1);
- assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'first-element', namespace: null});
- assert_connected_log_entry(log[2], element1);
- assert_constructor_log_entry(log[3], element2);
- assert_attribute_log_entry(log[4], {name: 'id', oldValue: null, newValue: 'second-element', namespace: null});
- assert_connected_log_entry(log[5], element2);
-}, 'Upgrading a custom element must invoke attributeChangedCallback and connectedCallback before start upgrading another element');
-
-test_with_window(function (contentWindow) {
- const contentDocument = contentWindow.document;
- contentDocument.write('<test-element id="first-element">');
- contentDocument.write('<test-element id="second-element">');
-
- const element1 = contentDocument.getElementById('first-element');
- const element2 = contentDocument.getElementById('second-element');
- assert_equals(Object.getPrototypeOf(element1), contentWindow.HTMLElement.prototype);
- assert_equals(Object.getPrototypeOf(element2), contentWindow.HTMLElement.prototype);
-
- let log = [];
- class TestElement extends contentWindow.HTMLElement {
- constructor() {
- super();
- log.push(create_constructor_log(this));
- if (this == element1)
- element2.setAttribute('class', 'foo');
- }
- connectedCallback(...args) {
- log.push(create_connected_callback_log(this, ...args));
- }
- attributeChangedCallback(...args) {
- log.push(create_attribute_changed_callback_log(this, ...args));
- }
- static get observedAttributes() { return ['id', 'class']; }
- }
- contentWindow.customElements.define('test-element', TestElement);
- assert_equals(Object.getPrototypeOf(element1), TestElement.prototype);
- assert_equals(Object.getPrototypeOf(element2), TestElement.prototype);
-
- assert_equals(log.length, 7);
- assert_constructor_log_entry(log[0], element1);
- assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'first-element', namespace: null});
- assert_connected_log_entry(log[2], element1);
- assert_constructor_log_entry(log[3], element2);
- assert_attribute_log_entry(log[4], {name: 'id', oldValue: null, newValue: 'second-element', namespace: null});
- assert_attribute_log_entry(log[5], {name: 'class', oldValue: null, newValue: 'foo', namespace: null});
- assert_connected_log_entry(log[6], element2);
-}, 'Mutating a undefined custom element while upgrading a custom element must not enqueue or invoke reactions on the mutated element');
-
-test_with_window(function (contentWindow) {
- let log = [];
- let element1;
- let element2;
- class TestElement extends contentWindow.HTMLElement {
- constructor() {
- super();
- log.push(create_constructor_log(this));
- }
- adoptedCallback(...args) {
- log.push(create_adopted_callback_log(this, ...args));
- if (this == element1)
- element3.setAttribute('id', 'foo');
- }
- connectedCallback(...args) {
- log.push(create_connected_callback_log(this, ...args));
- }
- attributeChangedCallback(...args) {
- log.push(create_attribute_changed_callback_log(this, ...args));
- }
- static get observedAttributes() { return ['id', 'class']; }
- }
-
- contentWindow.customElements.define('test-element', TestElement);
-
- let contentDocument = contentWindow.document;
- element1 = contentDocument.createElement('test-element');
- element2 = contentDocument.createElement('test-element');
- element3 = contentDocument.createElement('test-element');
- assert_equals(Object.getPrototypeOf(element1), TestElement.prototype);
- assert_equals(Object.getPrototypeOf(element2), TestElement.prototype);
- assert_equals(Object.getPrototypeOf(element3), TestElement.prototype);
-
- assert_equals(log.length, 3);
- assert_constructor_log_entry(log[0], element1);
- assert_constructor_log_entry(log[1], element2);
- assert_constructor_log_entry(log[2], element3);
- log = [];
-
- const container = contentDocument.createElement('div');
- container.appendChild(element1);
- container.appendChild(element2);
- container.appendChild(element3);
-
- const anotherDocument = document.implementation.createHTMLDocument();
- anotherDocument.documentElement.appendChild(container);
-
- assert_equals(log.length, 7);
- assert_adopted_log_entry(log[0], element1);
- assert_adopted_log_entry(log[1], element3);
- assert_connected_log_entry(log[2], element3);
- assert_attribute_log_entry(log[3], {name: 'id', oldValue: null, newValue: 'foo', namespace: null});
- assert_connected_log_entry(log[4], element1);
- assert_adopted_log_entry(log[5], element2);
- assert_connected_log_entry(log[6], element2);
-
-}, 'Mutating another custom element inside adopted callback must invoke all pending callbacks on the mutated element');
-
-
-</script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsreactionsforwebkitextensionshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/custom-elements/reactions-for-webkit-extensions.html (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/reactions-for-webkit-extensions.html        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/fast/custom-elements/reactions-for-webkit-extensions.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -9,7 +9,6 @@
</span><span class="cx"> <script src="../../resources/testharnessreport.js"></script>
</span><span class="cx"> <script src="../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
</span><span class="cx"> <script src="../../imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js"></script>
</span><del>-<script src="resources/additional-helpers.js"></script>
</del><span class="cx"> </head>
</span><span class="cx"> <body>
</span><span class="cx"> <div id="log"></div>
</span></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsresourcesadditionalhelpersjs"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/resources/additional-helpers.js (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/resources/additional-helpers.js        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/fast/custom-elements/resources/additional-helpers.js        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -1,48 +0,0 @@
</span><del>-function create_constructor_log(element) {
- return {type: 'constructed', element: element};
-}
-
-function assert_constructor_log_entry(log, element) {
- assert_equals(log.type, 'constructed');
- assert_equals(log.element, element);
-}
-
-function create_connected_callback_log(element) {
- return {type: 'connected', element: element};
-}
-
-function assert_connected_log_entry(log, element) {
- assert_equals(log.type, 'connected');
- assert_equals(log.element, element);
-}
-
-function define_custom_element_in_window(window, name, observedAttributes) {
- let log = [];
-
- class CustomElement extends window.HTMLElement {
- constructor() {
- super();
- log.push({type: 'constructed', element: this});
- }
- attributeChangedCallback(...args) {
- log.push(create_attribute_changed_callback_log(this, ...args));
- }
- connectedCallback() { log.push({type: 'connected', element: this}); }
- disconnectedCallback() { log.push({type: 'disconnected', element: this}); }
- adoptedCallback(oldDocument, newDocument) { log.push({type: 'adopted', element: this, oldDocument: oldDocument, newDocument: newDocument}); }
- }
- CustomElement.observedAttributes = observedAttributes;
-
- window.customElements.define(name, CustomElement);
-
- return {
- name: name,
- class: CustomElement,
- takeLog: function () {
- let currentLog = log; log = [];
- currentLog.types = () => currentLog.map((entry) => entry.type);
- currentLog.last = () => currentLog[currentLog.length - 1];
- return currentLog;
- }
- };
-}
</del></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsupgradingenqueuereactionsexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions-expected.txt (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions-expected.txt        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -1,8 +0,0 @@
</span><del>-CONSOLE MESSAGE: line 140: Exception thrown as a part of test
-
-PASS Upgrading a custom element must enqueue attributeChangedCallback on each attribute
-PASS Upgrading a custom element not must enqueue attributeChangedCallback on unobserved attributes
-PASS Upgrading a custom element must enqueue connectedCallback if the element in the document
-PASS Upgrading a custom element must enqueue attributeChangedCallback before connectedCallback
-PASS Upgrading a custom element must not invoke attributeChangedCallback and connectedCallback when the element failed to upgrade
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsupgradingenqueuereactionshtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions.html (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions.html        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -1,159 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-<title>Custom Elements: CEReactions on Attr interface</title>
-<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
-<meta name="assert" content="value of Attr interface must have CEReactions">
-<meta name="help" content="https://dom.spec.whatwg.org/#node">
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<script src="../../imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js"></script>
-<script src="resources/additional-helpers.js"></script>
-</head>
-<body>
-<div id="log"></div>
-<script>
-setup({allow_uncaught_exception:true});
-
-test_with_window(function (contentWindow) {
- const contentDocument = contentWindow.document;
- contentDocument.write('<test-element id="some" title="This is a test">');
-
- const undefinedElement = contentDocument.querySelector('test-element');
- assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
-
- let log = [];
- class TestElement extends contentWindow.HTMLElement {
- constructor() {
- super();
- log.push(create_constructor_log(this));
- }
- attributeChangedCallback(...args) {
- log.push(create_attribute_changed_callback_log(this, ...args));
- }
- static get observedAttributes() { return ['id', 'title']; }
- }
- contentWindow.customElements.define('test-element', TestElement);
- assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
-
- assert_equals(log.length, 3);
- assert_constructor_log_entry(log[0], undefinedElement);
- assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'some', namespace: null});
- assert_attribute_log_entry(log[2], {name: 'title', oldValue: null, newValue: 'This is a test', namespace: null});
-}, 'Upgrading a custom element must enqueue attributeChangedCallback on each attribute');
-
-test_with_window(function (contentWindow) {
- const contentDocument = contentWindow.document;
- contentDocument.write('<test-element id="some" title="This is a test" class="foo">');
-
- const undefinedElement = contentDocument.querySelector('test-element');
- assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
-
- let log = [];
- class TestElement extends contentWindow.HTMLElement {
- constructor() {
- super();
- log.push(create_constructor_log(this));
- }
- attributeChangedCallback(...args) {
- log.push(create_attribute_changed_callback_log(this, ...args));
- }
- static get observedAttributes() { return ['class', 'id']; }
- }
- contentWindow.customElements.define('test-element', TestElement);
- assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
-
- assert_equals(log.length, 3);
- assert_constructor_log_entry(log[0], undefinedElement);
- assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'some', namespace: null});
- assert_attribute_log_entry(log[2], {name: 'class', oldValue: null, newValue: 'foo', namespace: null});
-}, 'Upgrading a custom element not must enqueue attributeChangedCallback on unobserved attributes');
-
-test_with_window(function (contentWindow) {
- const contentDocument = contentWindow.document;
- contentDocument.write('<test-element id="some" title="This is a test" class="foo">');
-
- const undefinedElement = contentDocument.querySelector('test-element');
- assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
-
- let log = [];
- class TestElement extends contentWindow.HTMLElement {
- constructor() {
- super();
- log.push(create_constructor_log(this));
- }
- connectedCallback(...args) {
- log.push(create_connected_callback_log(this, ...args));
- }
- }
- contentWindow.customElements.define('test-element', TestElement);
- assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
-
- assert_equals(log.length, 2);
- assert_constructor_log_entry(log[0], undefinedElement);
- assert_connected_log_entry(log[1], undefinedElement);
-}, 'Upgrading a custom element must enqueue connectedCallback if the element in the document');
-
-test_with_window(function (contentWindow) {
- const contentDocument = contentWindow.document;
- contentDocument.write('<test-element id="some" title="This is a test" class="foo">');
-
- const undefinedElement = contentDocument.querySelector('test-element');
- assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
-
- let log = [];
- class TestElement extends contentWindow.HTMLElement {
- constructor() {
- super();
- log.push(create_constructor_log(this));
- }
- connectedCallback(...args) {
- log.push(create_connected_callback_log(this, ...args));
- }
- attributeChangedCallback(...args) {
- log.push(create_attribute_changed_callback_log(this, ...args));
- }
- static get observedAttributes() { return ['class', 'id']; }
- }
- contentWindow.customElements.define('test-element', TestElement);
- assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
-
- assert_equals(log.length, 4);
- assert_constructor_log_entry(log[0], undefinedElement);
- assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'some', namespace: null});
- assert_attribute_log_entry(log[2], {name: 'class', oldValue: null, newValue: 'foo', namespace: null});
- assert_connected_log_entry(log[3], undefinedElement);
-}, 'Upgrading a custom element must enqueue attributeChangedCallback before connectedCallback');
-
-test_with_window(function (contentWindow) {
- const contentDocument = contentWindow.document;
- contentDocument.write('<test-element id="some" title="This is a test" class="foo">');
-
- const undefinedElement = contentDocument.querySelector('test-element');
- assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
-
- let log = [];
- class TestElement extends contentWindow.HTMLElement {
- constructor() {
- super();
- log.push(create_constructor_log(this));
- throw 'Exception thrown as a part of test';
- }
- connectedCallback(...args) {
- log.push(create_connected_callback_log(this, ...args));
- }
- attributeChangedCallback(...args) {
- log.push(create_attribute_changed_callback_log(this, ...args));
- }
- static get observedAttributes() { return ['class', 'id']; }
- }
- contentWindow.customElements.define('test-element', TestElement);
- assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
-
- assert_equals(log.length, 1);
- assert_constructor_log_entry(log[0], undefinedElement);
-}, 'Upgrading a custom element must not invoke attributeChangedCallback and connectedCallback when the element failed to upgrade');
-
-</script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2016-11-03 Ryosuke Niwa <rniwa@webkit.org>
+
+ Update custom elements tests
+ https://bugs.webkit.org/show_bug.cgi?id=164352
+
+ Reviewed by Antti Koivisto.
+
+ 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:
+
</ins><span class="cx"> 2016-11-03 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> IndexedDB 2.0: Rename IDBKeyRange.contains to IDBKeyRange.includes.
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementscustomelementreactionqueueexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementscustomelementreactionqueueexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS Upgrading a custom element must invoke attributeChangedCallback and connectedCallback before start upgrading another element
+PASS Mutating a undefined custom element while upgrading a custom element must not enqueue or invoke reactions on the mutated element
+PASS Mutating another custom element inside adopted callback must invoke all pending callbacks on the mutated element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementscustomelementreactionqueuehtmlfromrev208359trunkLayoutTestsfastcustomelementscustomelementreactionqueuehtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/custom-element-reaction-queue.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,157 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Each element must have its own custom element reaction queue</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="Each element must have its own custom element reaction queue">
+<meta name="help" content="https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reaction-queue">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="./resources/custom-elements-helpers.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow) {
+ const contentDocument = contentWindow.document;
+ contentDocument.write('<test-element id="first-element">');
+ contentDocument.write('<test-element id="second-element">');
+
+ const element1 = contentDocument.getElementById('first-element');
+ const element2 = contentDocument.getElementById('second-element');
+ assert_equals(Object.getPrototypeOf(element1), contentWindow.HTMLElement.prototype);
+ assert_equals(Object.getPrototypeOf(element2), contentWindow.HTMLElement.prototype);
+
+ let log = [];
+ class TestElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ log.push(create_constructor_log(this));
+ }
+ connectedCallback(...args) {
+ log.push(create_connected_callback_log(this, ...args));
+ }
+ attributeChangedCallback(...args) {
+ log.push(create_attribute_changed_callback_log(this, ...args));
+ }
+ static get observedAttributes() { return ['id']; }
+ }
+ contentWindow.customElements.define('test-element', TestElement);
+ assert_equals(Object.getPrototypeOf(element1), TestElement.prototype);
+ assert_equals(Object.getPrototypeOf(element2), TestElement.prototype);
+
+ assert_equals(log.length, 6);
+ assert_constructor_log_entry(log[0], element1);
+ assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'first-element', namespace: null});
+ assert_connected_log_entry(log[2], element1);
+ assert_constructor_log_entry(log[3], element2);
+ assert_attribute_log_entry(log[4], {name: 'id', oldValue: null, newValue: 'second-element', namespace: null});
+ assert_connected_log_entry(log[5], element2);
+}, 'Upgrading a custom element must invoke attributeChangedCallback and connectedCallback before start upgrading another element');
+
+test_with_window(function (contentWindow) {
+ const contentDocument = contentWindow.document;
+ contentDocument.write('<test-element id="first-element">');
+ contentDocument.write('<test-element id="second-element">');
+
+ const element1 = contentDocument.getElementById('first-element');
+ const element2 = contentDocument.getElementById('second-element');
+ assert_equals(Object.getPrototypeOf(element1), contentWindow.HTMLElement.prototype);
+ assert_equals(Object.getPrototypeOf(element2), contentWindow.HTMLElement.prototype);
+
+ let log = [];
+ class TestElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ log.push(create_constructor_log(this));
+ if (this == element1) {
+ element2.setAttribute('title', 'hi');
+ element2.removeAttribute('title');
+ element2.setAttribute('class', 'foo');
+ }
+ }
+ connectedCallback(...args) {
+ log.push(create_connected_callback_log(this, ...args));
+ }
+ attributeChangedCallback(...args) {
+ log.push(create_attribute_changed_callback_log(this, ...args));
+ }
+ static get observedAttributes() { return ['id', 'class', 'title']; }
+ }
+ contentWindow.customElements.define('test-element', TestElement);
+ assert_equals(Object.getPrototypeOf(element1), TestElement.prototype);
+ assert_equals(Object.getPrototypeOf(element2), TestElement.prototype);
+
+ assert_equals(log.length, 7);
+ assert_constructor_log_entry(log[0], element1);
+ assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'first-element', namespace: null});
+ assert_connected_log_entry(log[2], element1);
+ assert_constructor_log_entry(log[3], element2);
+ assert_attribute_log_entry(log[4], {name: 'id', oldValue: null, newValue: 'second-element', namespace: null});
+ assert_attribute_log_entry(log[5], {name: 'class', oldValue: null, newValue: 'foo', namespace: null});
+ assert_connected_log_entry(log[6], element2);
+}, 'Mutating a undefined custom element while upgrading a custom element must not enqueue or invoke reactions on the mutated element');
+
+test_with_window(function (contentWindow) {
+ let log = [];
+ let element1;
+ let element2;
+ class TestElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ log.push(create_constructor_log(this));
+ }
+ adoptedCallback(...args) {
+ log.push(create_adopted_callback_log(this, ...args));
+ if (this == element1)
+ element3.setAttribute('id', 'foo');
+ }
+ connectedCallback(...args) {
+ log.push(create_connected_callback_log(this, ...args));
+ }
+ attributeChangedCallback(...args) {
+ log.push(create_attribute_changed_callback_log(this, ...args));
+ }
+ static get observedAttributes() { return ['id', 'class']; }
+ }
+
+ contentWindow.customElements.define('test-element', TestElement);
+
+ let contentDocument = contentWindow.document;
+ element1 = contentDocument.createElement('test-element');
+ element2 = contentDocument.createElement('test-element');
+ element3 = contentDocument.createElement('test-element');
+ assert_equals(Object.getPrototypeOf(element1), TestElement.prototype);
+ assert_equals(Object.getPrototypeOf(element2), TestElement.prototype);
+ assert_equals(Object.getPrototypeOf(element3), TestElement.prototype);
+
+ assert_equals(log.length, 3);
+ assert_constructor_log_entry(log[0], element1);
+ assert_constructor_log_entry(log[1], element2);
+ assert_constructor_log_entry(log[2], element3);
+ log = [];
+
+ const container = contentDocument.createElement('div');
+ container.appendChild(element1);
+ container.appendChild(element2);
+ container.appendChild(element3);
+
+ const anotherDocument = document.implementation.createHTMLDocument();
+ anotherDocument.documentElement.appendChild(container);
+
+ assert_equals(log.length, 7);
+ assert_adopted_log_entry(log[0], element1);
+ assert_adopted_log_entry(log[1], element3);
+ assert_connected_log_entry(log[2], element3);
+ assert_attribute_log_entry(log[3], {name: 'id', oldValue: null, newValue: 'foo', namespace: null});
+ assert_connected_log_entry(log[4], element1);
+ assert_adopted_log_entry(log[5], element2);
+ assert_connected_log_entry(log[6], element2);
+
+}, 'Mutating another custom element inside adopted callback must invoke all pending callbacks on the mutated element');
+
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementshtmlconstructornewtargethtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -101,9 +101,9 @@
</span><span class="cx"> function TestElement() {
</span><span class="cx"> const o = Reflect.construct(w.HTMLParagraphElement, [], new.target);
</span><span class="cx">
</span><del>- assert_equals(Object.getPrototypeOf(o), window.HTMLParagraphElement,
</del><ins>+ assert_equals(Object.getPrototypeOf(o), window.HTMLParagraphElement.prototype,
</ins><span class="cx"> "Must use the HTMLParagraphElement from the realm of NewTarget");
</span><del>- assert_not_equals(Object.getPrototypeOf(o), w.HTMLParagraphElement,
</del><ins>+ assert_not_equals(Object.getPrototypeOf(o), w.HTMLParagraphElement.prototype,
</ins><span class="cx"> "Must not use the HTMLParagraphElement from the realm of the active function object (w.HTMLParagraphElement)");
</span><span class="cx">
</span><span class="cx"> return o;
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsCSSStyleDeclarationexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsCSSStyleDeclarationexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/CSSStyleDeclaration-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+
+PASS cssText on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute
+PASS cssText on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed
+PASS cssText on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute
+PASS cssText on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed
+PASS setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute
+PASS setProperty on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed
+PASS setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute
+PASS setProperty on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed
+PASS setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed
+PASS setProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed
+FAIL 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)
+FAIL 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)
+FAIL 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)
+FAIL 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)
+FAIL 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)
+FAIL 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)
+PASS removeProperty on CSSStyleDeclaration must enqueue an attributeChanged reaction when it removes a property from the observed style attribute
+PASS 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
+PASS cssFloat on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute
+PASS cssFloat on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed
+PASS A camel case attribute (borderWidth) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute
+PASS A camel case attribute (borderWidth) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed
+PASS A camel case attribute (borderWidth) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute
+PASS A camel case attribute (borderWidth) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed
+PASS A dashed property (border-width) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute
+PASS A dashed property (border-width) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed
+PASS A dashed property (border-width) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute
+PASS A dashed property (border-width) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed
+PASS A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute
+PASS A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed
+PASS A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute
+PASS A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed
+PASS A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute
+PASS A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed
+PASS A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration must enqueue an attributeChanged reaction when it mutates the observed style attribute
+PASS A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsCSSStyleDeclarationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration.html (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,85 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on CSSStyleDeclaration interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="cssText, setProperty, setPropertyValue, setPropertyPriority, removeProperty, cssFloat, and all camel cased attributes of CSSStyleDeclaration interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_mutating_style_property_value(function (instance, propertyName, idlName, value) {
+ instance.style.cssText = `${propertyName}: ${value}`;
+}, 'cssText on CSSStyleDeclaration');
+
+test_mutating_style_property_value(function (instance, propertyName, idlName, value) {
+ instance.style.setProperty(propertyName, value);
+}, 'setProperty on CSSStyleDeclaration');
+
+test_mutating_style_property_priority(function (instance, propertyName, idlName, isImportant) {
+ instance.style.setProperty(propertyName, instance.style[idlName], isImportant ? 'important': '');
+}, 'setProperty on CSSStyleDeclaration');
+
+test_mutating_style_property_value(function (instance, propertyName, idlName, value) {
+ instance.style.setPropertyValue(propertyName, value);
+}, 'setPropertyValue on CSSStyleDeclaration');
+
+test_mutating_style_property_priority(function (instance, propertyName, idlName, isImportant) {
+ instance.style.setPropertyPriority(propertyName, isImportant ? 'important': '');
+}, 'setPropertyPriority on CSSStyleDeclaration');
+
+test_removing_style_property_value(function (instance, propertyName, idlName) {
+ instance.style.removeProperty(propertyName);
+}, 'removeProperty on CSSStyleDeclaration');
+
+test(function () {
+ var element = define_new_custom_element(['style']);
+ var instance = document.createElement(element.name);
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ instance.style.cssFloat = 'left';
+ assert_equals(instance.getAttribute('style'), 'float: left;');
+ var logEntries = element.takeLog();
+ assert_array_equals(logEntries.types(), ['attributeChanged']);
+ assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: null, newValue: 'float: left;', namespace: null});
+}, 'cssFloat on CSSStyleDeclaration must enqueue an attributeChanged reaction when it adds the observed style attribute');
+
+test(function () {
+ var element = define_new_custom_element([]);
+ var instance = document.createElement(element.name);
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ instance.style.cssFloat = 'left';
+ assert_equals(instance.getAttribute('style'), 'float: left;');
+ assert_array_equals(element.takeLog().types(), []);
+}, 'cssFloat on CSSStyleDeclaration must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed');
+
+test_mutating_style_property_value(function (instance, propertyName, idlName, value) {
+ assert_equals(idlName, 'borderWidth');
+ instance.style.borderWidth = value;
+}, 'A camel case attribute (borderWidth) on CSSStyleDeclaration',
+ {propertyName: 'border-width', idlName: 'borderWidth', value1: '2px', value2: '4px'});
+
+test_mutating_style_property_value(function (instance, propertyName, idlName, value) {
+ assert_equals(propertyName, 'border-width');
+ instance.style['border-width'] = value;
+}, 'A dashed property (border-width) on CSSStyleDeclaration',
+ {propertyName: 'border-width', idlName: 'borderWidth', value1: '1px', value2: '5px'});
+
+test_mutating_style_property_value(function (instance, propertyName, idlName, value) {
+ instance.style.webkitFilter = value;
+}, 'A webkit prefixed camel case attribute (webkitFilter) on CSSStyleDeclaration',
+ {propertyName: 'filter', idlName: 'filter', value1: 'grayscale(20%)', value2: 'grayscale(30%)'});
+
+test_mutating_style_property_value(function (instance, propertyName, idlName, value) {
+ instance.style['-webkit-filter'] = value;
+}, 'A webkit prefixed dashed property (-webkit-filter) on CSSStyleDeclaration',
+ {propertyName: 'filter', idlName: 'filter', value1: 'grayscale(20%)', value2: 'grayscale(30%)'});
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsDocumentexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -3,4 +3,12 @@
</span><span class="cx"> PASS importNode on Document must construct a new custom element when importing a custom element from a template
</span><span class="cx"> PASS adoptNode on Document must enqueue an adopted reaction when importing a custom element
</span><span class="cx"> PASS execCommand on Document must enqueue a disconnected reaction when deleting a custom element from a contenteditable element
</span><ins>+PASS title on Document must enqueue disconnectedCallback when removing a custom element
+PASS body on Document must enqueue disconnectedCallback when removing a custom element
+PASS body on Document must enqueue connectedCallback when inserting a custom element
+PASS open on Document must enqueue disconnectedCallback when removing a custom element
+PASS write on Document must enqueue disconnectedCallback when removing a custom element
+PASS write on Document must enqueue connectedCallback after constructing a custom element
+PASS writeln on Document must enqueue disconnectedCallback when removing a custom element
+PASS writeln on Document must enqueue connectedCallback after constructing a custom element
</ins><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsDocumenthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -15,57 +15,140 @@
</span><span class="cx"> <div id="log"></div>
</span><span class="cx"> <script>
</span><span class="cx">
</span><del>-test(function () {
- var element = define_new_custom_element();
- var instance = document.createElement(element.name);
</del><ins>+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ const instance = contentDocument.createElement('custom-element');
</ins><span class="cx"> assert_array_equals(element.takeLog().types(), ['constructed']);
</span><span class="cx">
</span><del>- var newDoc = document.implementation.createHTMLDocument();
</del><ins>+ const newDoc = contentDocument.implementation.createHTMLDocument();
</ins><span class="cx"> newDoc.importNode(instance);
</span><span class="cx">
</span><span class="cx"> assert_array_equals(element.takeLog().types(), []);
</span><span class="cx"> }, 'importNode on Document must not construct a new custom element when importing a custom element into a window-less document');
</span><span class="cx">
</span><del>-test(function () {
- var element = define_new_custom_element();
- var template = document.createElement('template');
- template.innerHTML = `<${element.name}></${element.name}>`;
</del><ins>+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ const template = contentDocument.createElement('template');
+ template.innerHTML = '<custom-element></custom-element>';
</ins><span class="cx"> assert_array_equals(element.takeLog().types(), []);
</span><del>- document.importNode(template.content, true);
</del><ins>+ contentDocument.importNode(template.content, true);
</ins><span class="cx"> assert_array_equals(element.takeLog().types(), ['constructed']);
</span><span class="cx"> }, 'importNode on Document must construct a new custom element when importing a custom element from a template');
</span><span class="cx">
</span><del>-test(function () {
- var element = define_new_custom_element();
- var instance = document.createElement(element.name);
</del><ins>+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ const instance = contentDocument.createElement('custom-element');
</ins><span class="cx"> assert_array_equals(element.takeLog().types(), ['constructed']);
</span><span class="cx">
</span><del>- var newDoc = document.implementation.createHTMLDocument();
</del><ins>+ const newDoc = contentDocument.implementation.createHTMLDocument();
</ins><span class="cx"> newDoc.adoptNode(instance);
</span><span class="cx">
</span><del>- var logEntries = element.takeLog();
</del><ins>+ const logEntries = element.takeLog();
</ins><span class="cx"> assert_array_equals(logEntries.types(), ['adopted']);
</span><del>- assert_equals(logEntries.last().oldDocument, document);
</del><ins>+ assert_equals(logEntries.last().oldDocument, contentDocument);
</ins><span class="cx"> assert_equals(logEntries.last().newDocument, newDoc);
</span><span class="cx"> }, 'adoptNode on Document must enqueue an adopted reaction when importing a custom element');
</span><span class="cx">
</span><del>-test(function () {
- var element = define_new_custom_element();
- var instance = document.createElement(element.name);
</del><ins>+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ const instance = contentDocument.createElement('custom-element');
</ins><span class="cx">
</span><del>- var container = document.createElement('div');
</del><ins>+ const container = contentDocument.createElement('div');
</ins><span class="cx"> container.contentEditable = true;
</span><span class="cx"> container.appendChild(instance);
</span><del>- document.body.appendChild(container);
</del><ins>+ contentDocument.body.appendChild(container);
</ins><span class="cx">
</span><span class="cx"> assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
</span><span class="cx">
</span><span class="cx"> container.focus();
</span><del>- document.execCommand('delete', false, null);
</del><ins>+ contentDocument.execCommand('delete', false, null);
</ins><span class="cx">
</span><span class="cx"> assert_array_equals(element.takeLog().types(), ['disconnected']);
</span><span class="cx"> }, 'execCommand on Document must enqueue a disconnected reaction when deleting a custom element from a contenteditable element');
</span><span class="cx">
</span><ins>+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ contentDocument.title = '';
+ const title = contentDocument.querySelector('title');
+ const instance = contentDocument.createElement('custom-element');
+ title.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(title.innerHTML, '<custom-element>hello</custom-element>');
+
+ title.text = 'world';
+ assert_equals(title.innerHTML, 'world');
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'title on Document must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const body = contentDocument.body;
+ body.innerHTML = '<custom-element>hello</custom-element>';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(body.innerHTML, '<custom-element>hello</custom-element>');
+
+ contentDocument.body = contentDocument.createElement('body');
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'body on Document must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const instance = contentDocument.createElement('custom-element');
+ const body = contentDocument.createElement('body');
+ body.appendChild(instance);
+
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ assert_equals(body.innerHTML, '<custom-element></custom-element>');
+
+ contentDocument.body = body;
+ assert_array_equals(element.takeLog().types(), ['connected']);
+}, 'body on Document must enqueue connectedCallback when inserting a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = '<custom-element></custom-element>';
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+
+ contentDocument.open();
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'open on Document must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = '<custom-element></custom-element>';
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+
+ contentDocument.write('');
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'write on Document must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentWindow.document.write('<custom-element></custom-element>');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+}, 'write on Document must enqueue connectedCallback after constructing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = '<custom-element></custom-element>';
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+
+ contentDocument.writeln('');
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'writeln on Document must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentWindow.document.writeln('<custom-element></custom-element>');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+}, 'writeln on Document must enqueue connectedCallback after constructing a custom element');
+
</ins><span class="cx"> </script>
</span><span class="cx"> </body>
</span><span class="cx"> </html>
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLAnchorElementexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLAnchorElementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLAnchorElement-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS text on HTMLAnchorElement must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLAnchorElementhtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLAnchorElementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLAnchorElement.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLAnchorElement interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="text of HTMLAnchorElement interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<a><custom-element>hello</custom-element></a>`;
+ const anchor = contentDocument.querySelector('a');
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(anchor.innerHTML, '<custom-element>hello</custom-element>');
+
+ anchor.text = 'world';
+ assert_equals(anchor.innerHTML, 'world');
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'text on HTMLAnchorElement must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOptionElementexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLOptionElementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLOptionElement-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS text on HTMLOptionElement must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOptionElementhtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLOptionElementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLOptionElement.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLOptionElement interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="text of HTMLOptionElement interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<select><option></option></select>`;
+ const option = contentDocument.querySelector('option');
+ const instance = document.createElement('custom-element');
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ option.text = 'world';
+ assert_equals(option.innerHTML, 'world');
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'text on HTMLOptionElement must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOptionsCollectionexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLOptionsCollectionexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLOptionsCollection-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+
+PASS length on HTMLOptionsCollection must enqueue disconnectedCallback when removing a custom element
+PASS The indexed setter on HTMLOptionsCollection must enqueue connectedCallback when inserting a custom element
+PASS The indexed setter on HTMLOptionsCollection must enqueue disconnectedCallback when removing a custom element
+PASS add on HTMLOptionsCollection must enqueue connectedCallback when inserting a custom element
+PASS remove on HTMLOptionsCollection must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOptionsCollectionhtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLOptionsCollectionhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLOptionsCollection.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLOptionsCollection interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="length, the indexed setter, add, and remove of HTMLOptionsCollection interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<select><option></option></select>`;
+ const option = contentDocument.querySelector('option');
+
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ const select = contentDocument.querySelector('select');
+ assert_equals(select.options[0], option);
+ select.options.length = 0;
+ assert_equals(select.firstChild, null);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'length on HTMLOptionsCollection must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const contentDocument = contentWindow.document;
+ contentDocument.body.innerHTML = `<select></select>`;
+ const select = contentDocument.querySelector('select');
+
+ const option = contentDocument.createElement('option');
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ assert_equals(select.options.length, 0);
+ select.options[0] = option;
+ assert_equals(select.options.length, 1);
+ assert_array_equals(element.takeLog().types(), ['connected']);
+}, 'The indexed setter on HTMLOptionsCollection must enqueue connectedCallback when inserting a custom element');
+
+test_with_window(function (contentWindow) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const contentDocument = contentWindow.document;
+ contentDocument.body.innerHTML = `<select><option></option></select>`;
+ const option = contentDocument.querySelector('option');
+
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ const select = contentDocument.querySelector('select');
+ assert_equals(select.options[0], option);
+ select.options[0] = null;
+ assert_equals(select.options.length, 0);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'The indexed setter on HTMLOptionsCollection must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const contentDocument = contentWindow.document;
+ contentDocument.body.innerHTML = `<select></select>`;
+ const select = contentDocument.querySelector('select');
+
+ const option = contentDocument.createElement('option');
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ assert_equals(select.options.length, 0);
+ select.options.add(option);
+ assert_equals(select.options.length, 1);
+ assert_array_equals(element.takeLog().types(), ['connected']);
+}, 'add on HTMLOptionsCollection must enqueue connectedCallback when inserting a custom element');
+
+test_with_window(function (contentWindow) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const contentDocument = contentWindow.document;
+ contentDocument.body.innerHTML = `<select><option></option></select>`;
+ const option = contentDocument.querySelector('option');
+
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ const select = contentDocument.querySelector('select');
+ assert_equals(select.options[0], option);
+ select.options.remove(0);
+ assert_equals(select.options.length, 0);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'remove on HTMLOptionsCollection must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOutputElementexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLOutputElementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLOutputElement-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS value on HTMLOutputElement must enqueue disconnectedCallback when removing a custom element
+PASS defaultValue on HTMLOutputElement must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLOutputElementhtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLOutputElementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLOutputElement.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLOutputElement interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="value and defaultValue of HTMLOutputElement interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<output><custom-element>hello</custom-element></output>`;
+ const anchor = contentDocument.querySelector('output');
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(anchor.innerHTML, '<custom-element>hello</custom-element>');
+
+ anchor.value = 'world';
+ assert_equals(anchor.innerHTML, 'world');
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'value on HTMLOutputElement must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<output><custom-element>hello</custom-element></output>`;
+ const anchor = contentDocument.querySelector('output');
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(anchor.innerHTML, '<custom-element>hello</custom-element>');
+
+ anchor.defaultValue = 'world';
+ assert_equals(anchor.innerHTML, 'world');
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'defaultValue on HTMLOutputElement must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLSelectElementexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLSelectElementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLSelectElement-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,7 @@
</span><ins>+
+PASS length on HTMLSelectElement must enqueue disconnectedCallback when removing a custom element
+PASS The indexed setter on HTMLSelectElement must enqueue connectedCallback when inserting a custom element
+PASS The indexed setter on HTMLSelectElement must enqueue disconnectedCallback when removing a custom element
+PASS add on HTMLSelectElement must enqueue connectedCallback when inserting a custom element
+PASS remove on HTMLSelectElement must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLSelectElementhtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLSelectElementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLSelectElement.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,122 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLSelectElement interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="length, add, remove, and the setter of HTMLSelectElement interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<select><option></option></select>`;
+ const option = contentDocument.querySelector('option');
+
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ const select = contentDocument.querySelector('select');
+ assert_equals(select.length, 1);
+ select.length = 0;
+ assert_equals(select.firstChild, null);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'length on HTMLSelectElement must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const contentDocument = contentWindow.document;
+ contentDocument.body.innerHTML = `<select></select>`;
+ const select = contentDocument.querySelector('select');
+
+ const option = contentDocument.createElement('option');
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ assert_equals(select.options.length, 0);
+ select[0] = option;
+ assert_equals(select.options.length, 1);
+ assert_array_equals(element.takeLog().types(), ['connected']);
+}, 'The indexed setter on HTMLSelectElement must enqueue connectedCallback when inserting a custom element');
+
+test_with_window(function (contentWindow) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const contentDocument = contentWindow.document;
+ contentDocument.body.innerHTML = `<select><option></option></select>`;
+ const option = contentDocument.querySelector('option');
+
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ const select = contentDocument.querySelector('select');
+ assert_equals(select.options[0], option);
+ select[0] = null;
+ assert_equals(select.options.length, 0);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'The indexed setter on HTMLSelectElement must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const contentDocument = contentWindow.document;
+ contentDocument.body.innerHTML = `<select></select>`;
+ const select = contentDocument.querySelector('select');
+
+ const option = contentDocument.createElement('option');
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ assert_equals(select.options.length, 0);
+ select.add(option);
+ assert_equals(select.options.length, 1);
+ assert_array_equals(element.takeLog().types(), ['connected']);
+}, 'add on HTMLSelectElement must enqueue connectedCallback when inserting a custom element');
+
+test_with_window(function (contentWindow) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+
+ const contentDocument = contentWindow.document;
+ contentDocument.body.innerHTML = `<select><option></option></select>`;
+ const option = contentDocument.querySelector('option');
+
+ const instance = contentDocument.createElement(element.name);
+ option.appendChild(instance);
+ instance.textContent = 'hello';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(option.innerHTML, '<custom-element>hello</custom-element>');
+
+ const select = contentDocument.querySelector('select');
+ assert_equals(select.options[0], option);
+ select.remove(0);
+ assert_equals(select.options.length, 0);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'remove on HTMLSelectElement must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableElementexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLTableElementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLTableElement-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+
+PASS caption on HTMLTableElement must enqueue connectedCallback when inserting a custom element
+PASS caption on HTMLTableElement must enqueue disconnectedCallback when removing a custom element
+PASS deleteCaption() on HTMLTableElement must enqueue disconnectedCallback when removing a custom element
+PASS tHead on HTMLTableElement must enqueue connectedCallback when inserting a custom element
+PASS tHead on HTMLTableElement must enqueue disconnectedCallback when removing a custom element
+PASS deleteTHead() on HTMLTableElement must enqueue disconnectedCallback when removing a custom element
+PASS tFoot on HTMLTableElement must enqueue connectedCallback when inserting a custom element
+PASS tFoot on HTMLTableElement must enqueue disconnectedCallback when removing a custom element
+PASS deleteTFoot() on HTMLTableElement must enqueue disconnectedCallback when removing a custom element
+PASS deleteRow() on HTMLTableElement must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableElementhtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLTableElementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLTableElement.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,173 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLTableElement interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="caption, deleteCaption, thead, deleteTHead, tFoot, deleteTFoot, and deleteRow of HTMLTableElement interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table></table>`;
+ const table = contentDocument.querySelector('table');
+
+ const caption = contentDocument.createElement('caption');
+ caption.innerHTML = '<custom-element>hello</custom-element>';
+
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ assert_equals(caption.innerHTML, '<custom-element>hello</custom-element>');
+
+ assert_equals(table.caption, null);
+ table.caption = caption;
+ assert_array_equals(element.takeLog().types(), ['connected']);
+}, 'caption on HTMLTableElement must enqueue connectedCallback when inserting a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><caption><custom-element>hello</custom-element></caption></table>`;
+ const caption = contentDocument.querySelector('caption');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(caption.innerHTML, '<custom-element>hello</custom-element>');
+
+ const table = contentDocument.querySelector('table');
+ assert_equals(table.caption, caption);
+ const newCaption = contentDocument.createElement('caption');
+ table.caption = newCaption; // Chrome doesn't support setting to null.
+ assert_equals(table.caption, newCaption);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'caption on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><caption><custom-element>hello</custom-element></caption></table>`;
+ const caption = contentDocument.querySelector('caption');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(caption.innerHTML, '<custom-element>hello</custom-element>');
+
+ const table = contentDocument.querySelector('table');
+ assert_equals(table.caption, caption);
+ const newCaption = contentDocument.createElement('caption');
+ table.deleteCaption();
+ assert_equals(table.caption, null);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'deleteCaption() on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
+
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table></table>`;
+ const table = contentDocument.querySelector('table');
+
+ const thead = contentDocument.createElement('thead');
+ thead.innerHTML = '<tr><td><custom-element>hello</custom-element></td></tr>';
+
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ assert_equals(thead.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
+
+ assert_equals(table.tHead, null);
+ table.tHead = thead;
+ assert_array_equals(element.takeLog().types(), ['connected']);
+}, 'tHead on HTMLTableElement must enqueue connectedCallback when inserting a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><thead><tr><td><custom-element>hello</custom-element></td></tr></thead></table>`;
+ const thead = contentDocument.querySelector('thead');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(thead.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
+
+ const table = contentDocument.querySelector('table');
+ assert_equals(table.tHead, thead);
+ const newThead = contentDocument.createElement('thead');
+ table.tHead = newThead; // Chrome doesn't support setting to null.
+ assert_equals(table.tHead, newThead);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'tHead on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><thead><tr><td><custom-element>hello</custom-element></td></tr></thead></table>`;
+ const thead = contentDocument.querySelector('thead');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(thead.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
+
+ const table = contentDocument.querySelector('table');
+ assert_equals(table.tHead, thead);
+ table.deleteTHead();
+ assert_equals(table.tHead, null);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'deleteTHead() on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
+
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table></table>`;
+ const table = contentDocument.querySelector('table');
+
+ const tfoot = contentDocument.createElement('tfoot');
+ tfoot.innerHTML = '<tr><td><custom-element>hello</custom-element></td></tr>';
+
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ assert_equals(tfoot.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
+
+ assert_equals(table.tFoot, null);
+ table.tFoot = tfoot;
+ assert_array_equals(element.takeLog().types(), ['connected']);
+}, 'tFoot on HTMLTableElement must enqueue connectedCallback when inserting a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><tfoot><tr><td><custom-element>hello</custom-element></td></tr></tfoot></table>`;
+ const tfoot = contentDocument.querySelector('tfoot');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(tfoot.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
+
+ const table = contentDocument.querySelector('table');
+ assert_equals(table.tFoot, tfoot);
+ const newThead = contentDocument.createElement('tfoot');
+ table.tFoot = newThead; // Chrome doesn't support setting to null.
+ assert_equals(table.tFoot, newThead);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'tFoot on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><tfoot><tr><td><custom-element>hello</custom-element></td></tr></tfoot></table>`;
+ const tfoot = contentDocument.querySelector('tfoot');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(tfoot.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
+
+ const table = contentDocument.querySelector('table');
+ assert_equals(table.tFoot, tfoot);
+ table.deleteTFoot();
+ assert_equals(table.tFoot, null);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'deleteTFoot() on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
+
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><tr><td><custom-element>hello</custom-element></td></tr></table>`;
+ const tr = contentDocument.querySelector('tr');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(tr.innerHTML, '<td><custom-element>hello</custom-element></td>');
+
+ const table = contentDocument.querySelector('table');
+ assert_equals(table.rows.length, 1);
+ assert_equals(table.rows[0], tr);
+ table.deleteRow(0);
+ assert_equals(table.rows.length, 0);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'deleteRow() on HTMLTableElement must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableRowElementexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLTableRowElementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLTableRowElement-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS deleteCell() on HTMLTableRowElement must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableRowElementhtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLTableRowElementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLTableRowElement.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLTableRowElement interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="deleteCell of HTMLTableRowElement interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><tr><td><custom-element>hello</custom-element></td></tr></table>`;
+ const td = contentDocument.querySelector('td');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(td.innerHTML, '<custom-element>hello</custom-element>');
+
+ const table = contentDocument.querySelector('table');
+ const row = table.rows[0];
+ assert_equals(row.cells[0], td);
+ row.deleteCell(0);
+ assert_equals(row.cells.length, 0);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'deleteCell() on HTMLTableRowElement must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableSectionElementexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLTableSectionElementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLTableSectionElement-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS deleteRow() on HTMLTableSectionElement on thead must enqueue disconnectedCallback when removing a custom element
+PASS deleteRow() on HTMLTableSectionElement on tfoot must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTableSectionElementhtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLTableSectionElementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLTableSectionElement.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLTableSectionElement interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="deleteRow of HTMLTableSectionElement interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><thead><tr><td><custom-element>hello</custom-element></td></tr></thead></table>`;
+ const thead = contentDocument.querySelector('thead');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(thead.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
+
+ const table = contentDocument.querySelector('table');
+ assert_equals(table.tHead, thead);
+ table.tHead.deleteRow(0);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'deleteRow() on HTMLTableSectionElement on thead must enqueue disconnectedCallback when removing a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ contentDocument.body.innerHTML = `<table><tfoot><tr><td><custom-element>hello</custom-element></td></tr></tfoot></table>`;
+ const tfoot = contentDocument.querySelector('tfoot');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+ assert_equals(tfoot.innerHTML, '<tr><td><custom-element>hello</custom-element></td></tr>');
+
+ const table = contentDocument.querySelector('table');
+ assert_equals(table.tFoot, tfoot);
+ table.tFoot.deleteRow(0);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'deleteRow() on HTMLTableSectionElement on tfoot must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTitleElementexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLTitleElementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLTitleElement-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS text on HTMLTitleElement must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsHTMLTitleElementhtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsHTMLTitleElementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/HTMLTitleElement.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on HTMLTitleElement interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="text of HTMLTitleElement interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ const instance = contentWindow.document.createElement(element.name);
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+
+ contentWindow.document.title = 'hello';
+ const titleElement = contentDocument.querySelector('title');
+ titleElement.appendChild(instance);
+ assert_array_equals(element.takeLog().types(), ['connected']);
+ assert_equals(titleElement.childNodes.length, 2);
+
+ titleElement.text = 'world';
+ assert_equals(titleElement.childNodes.length, 1);
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+}, 'text on HTMLTitleElement must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsShadowRootexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsreactionsShadowRootexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/ShadowRoot-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS innerHTML on ShadowRoot must upgrade a custom element
+PASS innerHTML on ShadowRoot must enqueue connectedCallback on newly upgraded custom elements when the shadow root is connected
+PASS innerHTML on ShadowRoot must enqueue disconnectedCallback when removing a custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsShadowRoothtmlfromrev208359trunkLayoutTestsfastcustomelementsreactionsShadowRoothtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/reactions/ShadowRoot.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,52 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: CEReactions on ShadowRoot interface</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="innerHTML of ShadowRoot interface must have CEReactions">
+<meta name="help" content="https://dom.spec.whatwg.org/#node">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+<script src="./resources/reactions.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ const host = contentDocument.createElement('div');
+ const shadowRoot = host.attachShadow({mode: 'closed'});
+ shadowRoot.innerHTML = '<custom-element></custom-element>';
+
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+}, 'innerHTML on ShadowRoot must upgrade a custom element');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ const host = contentDocument.createElement('div');
+ contentDocument.body.appendChild(host);
+ const shadowRoot = host.attachShadow({mode: 'closed'});
+ shadowRoot.innerHTML = '<custom-element></custom-element>';
+
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+}, 'innerHTML on ShadowRoot must enqueue connectedCallback on newly upgraded custom elements when the shadow root is connected');
+
+test_with_window(function (contentWindow, contentDocument) {
+ const element = define_custom_element_in_window(contentWindow, 'custom-element', []);
+ const host = contentDocument.createElement('div');
+ contentDocument.body.appendChild(host);
+
+ const shadowRoot = host.attachShadow({mode: 'closed'});
+ shadowRoot.innerHTML = '<custom-element></custom-element>';
+ assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
+
+ shadowRoot.innerHTML = '';
+ assert_array_equals(element.takeLog().types(), ['disconnected']);
+
+}, 'innerHTML on ShadowRoot must enqueue disconnectedCallback when removing a custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsresourcesreactionsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -260,3 +260,102 @@
</span><span class="cx"> assert_array_equals(element.takeLog().types(), []);
</span><span class="cx"> }, name + ' must not enqueue an attributeChanged reaction when removing an existing unobserved attribute');
</span><span class="cx"> }
</span><ins>+
+function test_mutating_style_property_value(testFunction, name, options) {
+ const propertyName = (options || {}).propertyName || 'color';
+ const idlName = (options || {}).idlName || 'color';
+ const value1 = (options || {}).value1 || 'blue';
+ const rule1 = `${propertyName}: ${value1};`;
+ const value2 = (options || {}).value2 || 'red';
+ const rule2 = `${propertyName}: ${value2};`;
+
+ test(function () {
+ var element = define_new_custom_element(['style']);
+ var instance = document.createElement(element.name);
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ testFunction(instance, propertyName, idlName, value1);
+ assert_equals(instance.getAttribute('style'), rule1);
+ var logEntries = element.takeLog();
+ assert_array_equals(logEntries.types(), ['attributeChanged']);
+ assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: null, newValue: rule1, namespace: null});
+ }, name + ' must enqueue an attributeChanged reaction when it adds the observed style attribute');
+
+ test(function () {
+ var element = define_new_custom_element(['title']);
+ var instance = document.createElement(element.name);
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ testFunction(instance, propertyName, idlName, value1);
+ assert_equals(instance.getAttribute('style'), rule1);
+ assert_array_equals(element.takeLog().types(), []);
+ }, name + ' must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed');
+
+ test(function () {
+ var element = define_new_custom_element(['style']);
+ var instance = document.createElement(element.name);
+ testFunction(instance, propertyName, idlName, value1);
+ assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
+ testFunction(instance, propertyName, idlName, value2);
+ assert_equals(instance.getAttribute('style'), rule2);
+ var logEntries = element.takeLog();
+ assert_array_equals(logEntries.types(), ['attributeChanged']);
+ assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: rule1, newValue: rule2, namespace: null});
+ }, name + ' must enqueue an attributeChanged reaction when it mutates the observed style attribute');
+
+ test(function () {
+ var element = define_new_custom_element([]);
+ var instance = document.createElement(element.name);
+ testFunction(instance, propertyName, idlName, value1);
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ testFunction(instance, propertyName, idlName, value2);
+ assert_equals(instance.getAttribute('style'), rule2);
+ assert_array_equals(element.takeLog().types(), []);
+ }, name + ' must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed');
+}
+
+function test_removing_style_property_value(testFunction, name) {
+ test(function () {
+ var element = define_new_custom_element(['style']);
+ var instance = document.createElement(element.name);
+ instance.setAttribute('style', 'color: red; display: none;');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
+ testFunction(instance, 'color', 'color');
+ assert_equals(instance.getAttribute('style'), 'display: none;'); // Don't make this empty since browser behaviors are inconsistent now.
+ var logEntries = element.takeLog();
+ assert_array_equals(logEntries.types(), ['attributeChanged']);
+ assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: 'color: red; display: none;', newValue: 'display: none;', namespace: null});
+ }, name + ' must enqueue an attributeChanged reaction when it removes a property from the observed style attribute');
+
+ test(function () {
+ var element = define_new_custom_element(['class']);
+ var instance = document.createElement(element.name);
+ instance.setAttribute('style', 'color: red; display: none;');
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ testFunction(instance, 'color', 'color');
+ assert_equals(instance.getAttribute('style'), 'display: none;'); // Don't make this empty since browser behaviors are inconsistent now.
+ assert_array_equals(element.takeLog().types(), []);
+ }, name + ' must not enqueue an attributeChanged reaction when it removes a property from the style attribute but the style attribute is not observed');
+}
+
+function test_mutating_style_property_priority(testFunction, name) {
+ test(function () {
+ var element = define_new_custom_element(['style']);
+ var instance = document.createElement(element.name);
+ instance.setAttribute('style', 'color: red');
+ assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
+ testFunction(instance, 'color', 'color', true);
+ assert_equals(instance.getAttribute('style'), 'color: red !important;');
+ var logEntries = element.takeLog();
+ assert_array_equals(logEntries.types(), ['attributeChanged']);
+ assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: 'color: red', newValue: 'color: red !important;', namespace: null});
+ }, name + ' must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed');
+
+ test(function () {
+ var element = define_new_custom_element(['id']);
+ var instance = document.createElement(element.name);
+ instance.setAttribute('style', 'color: red');
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+ testFunction(instance, 'color', 'color', true);
+ assert_equals(instance.getAttribute('style'), 'color: red !important;');
+ assert_array_equals(element.takeLog().types(), []);
+ }, name + ' must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed');
+}
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsw3cimportlog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/w3c-import.log (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/w3c-import.log        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/w3c-import.log        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -16,6 +16,7 @@
</span><span class="cx"> ------------------------------------------------------------------------
</span><span class="cx"> List of files:
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Attr.html
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/CSSStyleDeclaration.html
</ins><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ChildNode.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMStringMap.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList.html
</span><span class="lines">@@ -22,9 +23,19 @@
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Element.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ElementContentEditable.html
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAnchorElement.html
</ins><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLElement.html
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionElement.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptionsCollection.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOutputElement.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSelectElement.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableElement.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableRowElement.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableSectionElement.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTitleElement.html
</ins><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/NamedNodeMap.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Node.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ParentNode.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Selection.html
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/ShadowRoot.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsresourcescustomelementshelpersjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/resources/custom-elements-helpers.js        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -16,11 +16,78 @@
</span><span class="cx"> promise_test((t) => {
</span><span class="cx"> return create_window_in_test(t, srcdoc)
</span><span class="cx"> .then((w) => {
</span><del>- f(w);
</del><ins>+ f(w, w.document);
</ins><span class="cx"> });
</span><span class="cx"> }, name);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+function define_custom_element_in_window(window, name, observedAttributes) {
+ let log = [];
+
+ class CustomElement extends window.HTMLElement {
+ constructor() {
+ super();
+ log.push(create_constructor_log(this));
+ }
+ attributeChangedCallback(...args) {
+ log.push(create_attribute_changed_callback_log(this, ...args));
+ }
+ connectedCallback() { log.push(create_connected_callback_log(this)); }
+ disconnectedCallback() { log.push(create_disconnected_callback_log(this)); }
+ adoptedCallback(oldDocument, newDocument) { log.push({type: 'adopted', element: this, oldDocument: oldDocument, newDocument: newDocument}); }
+ }
+ CustomElement.observedAttributes = observedAttributes;
+
+ window.customElements.define(name, CustomElement);
+
+ return {
+ name: name,
+ class: CustomElement,
+ takeLog: function () {
+ let currentLog = log; log = [];
+ currentLog.types = () => currentLog.map((entry) => entry.type);
+ currentLog.last = () => currentLog[currentLog.length - 1];
+ return currentLog;
+ }
+ };
+}
+
+function create_constructor_log(element) {
+ return {type: 'constructed', element: element};
+}
+
+function assert_constructor_log_entry(log, element) {
+ assert_equals(log.type, 'constructed');
+ assert_equals(log.element, element);
+}
+
+function create_connected_callback_log(element) {
+ return {type: 'connected', element: element};
+}
+
+function assert_connected_log_entry(log, element) {
+ assert_equals(log.type, 'connected');
+ assert_equals(log.element, element);
+}
+
+function create_disconnected_callback_log(element) {
+ return {type: 'disconnected', element: element};
+}
+
+function assert_disconnected_log_entry(log, element) {
+ assert_equals(log.type, 'disconnected');
+ assert_equals(log.element, element);
+}
+
+function assert_adopted_log_entry(log, element) {
+ assert_equals(log.type, 'adopted');
+ assert_equals(log.element, element);
+}
+
+function create_adopted_callback_log(element) {
+ return {type: 'adopted', element: element};
+}
+
</ins><span class="cx"> function create_attribute_changed_callback_log(element, name, oldValue, newValue, namespace) {
</span><span class="cx"> return {
</span><span class="cx"> type: 'attributeChanged',
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingupgradingenqueuereactionsexpectedtxtfromrev208359trunkLayoutTestsfastcustomelementsupgradingenqueuereactionsexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions-expected.txt (from rev 208359, trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions-expected.txt) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions-expected.txt        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+CONSOLE MESSAGE: line 139: Exception thrown as a part of test
+
+PASS Upgrading a custom element must enqueue attributeChangedCallback on each attribute
+PASS Upgrading a custom element not must enqueue attributeChangedCallback on unobserved attributes
+PASS Upgrading a custom element must enqueue connectedCallback if the element in the document
+PASS Upgrading a custom element must enqueue attributeChangedCallback before connectedCallback
+PASS Upgrading a custom element must not invoke attributeChangedCallback and connectedCallback when the element failed to upgrade
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingupgradingenqueuereactionshtmlfromrev208359trunkLayoutTestsfastcustomelementsupgradingenqueuereactionshtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions.html (from rev 208359, trunk/LayoutTests/fast/custom-elements/upgrading-enqueue-reactions.html) (0 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions.html        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -0,0 +1,158 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Upgrading custom elements should enqueue attributeChanged and connected callbacks</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="Upgrading custom elements should enqueue attributeChanged and connected callbacksml">
+<meta name="help" content="https://html.spec.whatwg.org/#upgrades">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../resources/custom-elements-helpers.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+setup({allow_uncaught_exception:true});
+
+test_with_window(function (contentWindow) {
+ const contentDocument = contentWindow.document;
+ contentDocument.write('<test-element id="some" title="This is a test">');
+
+ const undefinedElement = contentDocument.querySelector('test-element');
+ assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
+
+ let log = [];
+ class TestElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ log.push(create_constructor_log(this));
+ }
+ attributeChangedCallback(...args) {
+ log.push(create_attribute_changed_callback_log(this, ...args));
+ }
+ static get observedAttributes() { return ['id', 'title']; }
+ }
+ contentWindow.customElements.define('test-element', TestElement);
+ assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
+
+ assert_equals(log.length, 3);
+ assert_constructor_log_entry(log[0], undefinedElement);
+ assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'some', namespace: null});
+ assert_attribute_log_entry(log[2], {name: 'title', oldValue: null, newValue: 'This is a test', namespace: null});
+}, 'Upgrading a custom element must enqueue attributeChangedCallback on each attribute');
+
+test_with_window(function (contentWindow) {
+ const contentDocument = contentWindow.document;
+ contentDocument.write('<test-element id="some" title="This is a test" class="foo">');
+
+ const undefinedElement = contentDocument.querySelector('test-element');
+ assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
+
+ let log = [];
+ class TestElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ log.push(create_constructor_log(this));
+ }
+ attributeChangedCallback(...args) {
+ log.push(create_attribute_changed_callback_log(this, ...args));
+ }
+ static get observedAttributes() { return ['class', 'id']; }
+ }
+ contentWindow.customElements.define('test-element', TestElement);
+ assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
+
+ assert_equals(log.length, 3);
+ assert_constructor_log_entry(log[0], undefinedElement);
+ assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'some', namespace: null});
+ assert_attribute_log_entry(log[2], {name: 'class', oldValue: null, newValue: 'foo', namespace: null});
+}, 'Upgrading a custom element not must enqueue attributeChangedCallback on unobserved attributes');
+
+test_with_window(function (contentWindow) {
+ const contentDocument = contentWindow.document;
+ contentDocument.write('<test-element id="some" title="This is a test" class="foo">');
+
+ const undefinedElement = contentDocument.querySelector('test-element');
+ assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
+
+ let log = [];
+ class TestElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ log.push(create_constructor_log(this));
+ }
+ connectedCallback(...args) {
+ log.push(create_connected_callback_log(this, ...args));
+ }
+ }
+ contentWindow.customElements.define('test-element', TestElement);
+ assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
+
+ assert_equals(log.length, 2);
+ assert_constructor_log_entry(log[0], undefinedElement);
+ assert_connected_log_entry(log[1], undefinedElement);
+}, 'Upgrading a custom element must enqueue connectedCallback if the element in the document');
+
+test_with_window(function (contentWindow) {
+ const contentDocument = contentWindow.document;
+ contentDocument.write('<test-element id="some" title="This is a test" class="foo">');
+
+ const undefinedElement = contentDocument.querySelector('test-element');
+ assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
+
+ let log = [];
+ class TestElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ log.push(create_constructor_log(this));
+ }
+ connectedCallback(...args) {
+ log.push(create_connected_callback_log(this, ...args));
+ }
+ attributeChangedCallback(...args) {
+ log.push(create_attribute_changed_callback_log(this, ...args));
+ }
+ static get observedAttributes() { return ['class', 'id']; }
+ }
+ contentWindow.customElements.define('test-element', TestElement);
+ assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
+
+ assert_equals(log.length, 4);
+ assert_constructor_log_entry(log[0], undefinedElement);
+ assert_attribute_log_entry(log[1], {name: 'id', oldValue: null, newValue: 'some', namespace: null});
+ assert_attribute_log_entry(log[2], {name: 'class', oldValue: null, newValue: 'foo', namespace: null});
+ assert_connected_log_entry(log[3], undefinedElement);
+}, 'Upgrading a custom element must enqueue attributeChangedCallback before connectedCallback');
+
+test_with_window(function (contentWindow) {
+ const contentDocument = contentWindow.document;
+ contentDocument.write('<test-element id="some" title="This is a test" class="foo">');
+
+ const undefinedElement = contentDocument.querySelector('test-element');
+ assert_equals(Object.getPrototypeOf(undefinedElement), contentWindow.HTMLElement.prototype);
+
+ let log = [];
+ class TestElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ log.push(create_constructor_log(this));
+ throw 'Exception thrown as a part of test';
+ }
+ connectedCallback(...args) {
+ log.push(create_connected_callback_log(this, ...args));
+ }
+ attributeChangedCallback(...args) {
+ log.push(create_attribute_changed_callback_log(this, ...args));
+ }
+ static get observedAttributes() { return ['class', 'id']; }
+ }
+ contentWindow.customElements.define('test-element', TestElement);
+ assert_equals(Object.getPrototypeOf(undefinedElement), TestElement.prototype);
+
+ assert_equals(log.length, 1);
+ assert_constructor_log_entry(log[0], undefinedElement);
+}, 'Upgrading a custom element must not invoke attributeChangedCallback and connectedCallback when the element failed to upgrade');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingw3cimportlog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -16,4 +16,5 @@
</span><span class="cx"> ------------------------------------------------------------------------
</span><span class="cx"> List of files:
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode.html
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-enqueue-reactions.html
</ins><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element.html
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsw3cimportlog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/w3c-import.log (208359 => 208360)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/w3c-import.log        2016-11-04 01:08:55 UTC (rev 208359)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/w3c-import.log        2016-11-04 01:37:01 UTC (rev 208360)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/adopted-callback.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/attribute-changed-callback.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/connected-callbacks.html
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-reaction-queue.html
</ins><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/disconnected-callbacks.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/reaction-timing.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading.html
</span></span></pre>
</div>
</div>
</body>
</html>