<!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>[207703] 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/207703">207703</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-21 19:47:18 -0700 (Fri, 21 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update custom elements tests
https://bugs.webkit.org/show_bug.cgi?id=163815
Reviewed by Joseph Pecoraro.
LayoutTests/imported/w3c:
Re-import the custom elements as of 5078aa44879c87c38b6430670583951dbeae3025.
* web-platform-tests/custom-elements/Document-createElement-expected.txt: Moved from from fast/custom-elements/Document-createElement.html.
* web-platform-tests/custom-elements/Document-createElement.html: Ditto.
* web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write-expected.txt: Moved from from fast/custom-elements/parser/.
* web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write.html: Ditto.
* web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt: Ditto.
* web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously.html: Ditto.
* web-platform-tests/custom-elements/parser/parser-constructs-custom-elements-expected.txt: Ditto.
* web-platform-tests/custom-elements/parser/parser-constructs-custom-elements.html: Ditto.
* web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element-expected.txt: Ditto.
* web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element.html: Ditto.
* web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt: Ditto.
* web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html: Ditto.
* web-platform-tests/custom-elements/parser/parser-uses-constructed-element-expected.txt: Ditto.
* web-platform-tests/custom-elements/parser/parser-uses-constructed-element.html: Ditto.
* web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt: Ditto.
* web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document.html: Ditto.
* web-platform-tests/custom-elements/parser/w3c-import.log: Added.
* web-platform-tests/custom-elements/reactions/DOMTokenList-expected.txt:
* web-platform-tests/custom-elements/reactions/DOMTokenList.html:
* web-platform-tests/custom-elements/reactions/Document-expected.txt:
* web-platform-tests/custom-elements/reactions/Document.html:
* web-platform-tests/custom-elements/reactions/Range-expected.txt:
* web-platform-tests/custom-elements/reactions/resources/reactions.js:
* web-platform-tests/custom-elements/upgrading-expected.txt: Added.
* web-platform-tests/custom-elements/upgrading.html: Moved from fast/custom-elements/enqueue-custom-element-upgrade-reaction.html.
* web-platform-tests/custom-elements/upgrading/Node-cloneNode-expected.txt: Moved from fast/custom-elements/upgrading/.
* web-platform-tests/custom-elements/upgrading/Node-cloneNode.html: Ditto.
* web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element-expected.txt: Ditto.
* web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element.html: Ditto.
* web-platform-tests/custom-elements/upgrading/w3c-import.log: Added.
* web-platform-tests/custom-elements/w3c-import.log:
LayoutTests:
Removed the tests that have been upstreamed and reimported from web-platform-tests.
* fast/custom-elements/Document-createElement-expected.txt: Removed.
* fast/custom-elements/enqueue-custom-element-upgrade-reaction-expected.txt: Removed.
* fast/custom-elements/parser/: Removed.
* fast/custom-elements/upgrading/: Removed.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsDOMTokenListexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsDOMTokenListhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList.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="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsRangeexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsresourcesreactionsjs">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js</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="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsDocumentcreateElementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsDocumentcreateElementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement.html</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementindocumentwriteexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementindocumentwritehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementsynchronouslyexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementsynchronouslyhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementsexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-elements-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementshtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-elements.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserfallsbacktounknownelementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserfallsbacktounknownelementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparsersetsattributesandchildrenexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparsersetsattributesandchildrenhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserusesconstructedelementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-constructed-element-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserusesconstructedelementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-constructed-element.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserusesregistryofownerdocumentexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserusesregistryofownerdocumenthtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/w3c-import.log</a></li>
<li>trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/</li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingNodecloneNodeexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingNodecloneNodehtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingupgradingparsercreatedelementexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingupgradingparsercreatedelementhtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingw3cimportlog">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradinghtml">trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading.html</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcustomelementsDocumentcreateElementexpectedtxt">trunk/LayoutTests/fast/custom-elements/Document-createElement-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcustomelementsDocumentcreateElementhtml">trunk/LayoutTests/fast/custom-elements/Document-createElement.html</a></li>
<li><a href="#trunkLayoutTestsfastcustomelementsenqueuecustomelementupgradereactionexpectedtxt">trunk/LayoutTests/fast/custom-elements/enqueue-custom-element-upgrade-reaction-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcustomelementsenqueuecustomelementupgradereactionhtml">trunk/LayoutTests/fast/custom-elements/enqueue-custom-element-upgrade-reaction.html</a></li>
<li>trunk/LayoutTests/fast/custom-elements/parser/</li>
<li>trunk/LayoutTests/fast/custom-elements/upgrading/</li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/ChangeLog        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-10-21 Ryosuke Niwa <rniwa@webkit.org>
+
+ Update custom elements tests
+ https://bugs.webkit.org/show_bug.cgi?id=163815
+
+ Reviewed by Joseph Pecoraro.
+
+ Removed the tests that have been upstreamed and reimported from web-platform-tests.
+
+ * fast/custom-elements/Document-createElement-expected.txt: Removed.
+ * fast/custom-elements/enqueue-custom-element-upgrade-reaction-expected.txt: Removed.
+ * fast/custom-elements/parser/: Removed.
+ * fast/custom-elements/upgrading/: Removed.
+
</ins><span class="cx"> 2016-10-21 Michael Catanzaro <mcatanzaro@igalia.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed GTK test gardening
</span></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsDocumentcreateElementexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/Document-createElement-expected.txt (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/Document-createElement-expected.txt        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/fast/custom-elements/Document-createElement-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -1,37 +0,0 @@
</span><del>-
-PASS document.createElement must create an instance of custom elements
-PASS document.createElement must report a TypeError when the result of Construct is not a DOM node
-PASS document.createElement must report a TypeError when the result of Construct is a TextNode
-PASS document.createElement must report a NotSupportedError when attribute is added by setAttribute during construction
-PASS document.createElement must report a NotSupportedError when attribute is added by attributes.setNamedItem during construction
-PASS document.createElement must not report a NotSupportedError when attribute is added and removed during construction
-PASS document.createElement must report a NotSupportedError when a Text child is added during construction
-PASS document.createElement must report a NotSupportedError when a Comment child is added during construction
-PASS document.createElement must report a NotSupportedError when an element child is added during construction
-PASS document.createElement must not report a NotSupportedError when an element child is added and removed during construction
-PASS document.createElement must report a NotSupportedError when the element gets inserted into another element during construction
-PASS document.createElement must not report a NotSupportedError when the element is inserted and removed from another element during construction
-PASS document.createElement must report a NotSupportedError when the element is adopted into a document of a template element during construction
-PASS document.createElement must report a NotSupportedError when the element is inserted into a document of a template element during construction
-PASS document.createElement must not report a NotSupportedError when the element is adopted back from a document of a template element during construction
-PASS document.createElement must report a NotSupportedError when the element is adopted into a new document during construction
-PASS document.createElement must report a NotSupportedError when the element is inserted into a new document during construction
-PASS document.createElement must not report a NotSupportedError when the element is adopted back from a new document during construction
-PASS document.createElement must report a NotSupportedError when the element is adopted into a cloned document during construction
-PASS document.createElement must report a NotSupportedError when the element is inserted into a cloned document during construction
-PASS document.createElement must not report a NotSupportedError when the element is adopted back from a cloned document during construction
-PASS document.createElement must report a NotSupportedError when the element is adopted into a document created by createHTMLDocument during construction
-PASS document.createElement must report a NotSupportedError when the element is inserted into a document created by createHTMLDocument during construction
-PASS document.createElement must not report a NotSupportedError when the element is adopted back from a document created by createHTMLDocument during construction
-PASS document.createElement must report a NotSupportedError when the element is adopted into a HTML document created by createDocument during construction
-PASS document.createElement must report a NotSupportedError when the element is inserted into a HTML document created by createDocument during construction
-PASS document.createElement must not report a NotSupportedError when the element is adopted back from a HTML document created by createDocument during construction
-PASS document.createElement must report a NotSupportedError when the element is adopted into a document in an iframe during construction
-PASS document.createElement must report a NotSupportedError when the element is inserted into a document in an iframe during construction
-PASS document.createElement must not report a NotSupportedError when the element is adopted back from a document in an iframe during construction
-PASS document.createElement must report a NotSupportedError when the element is adopted into a HTML document fetched by XHR during construction
-PASS document.createElement must report a NotSupportedError when the element is inserted into a HTML document fetched by XHR during construction
-PASS document.createElement must not report a NotSupportedError when the element is adopted back from a HTML document fetched by XHR during construction
-PASS document.createElement must report a NotSupportedError when the local name of the element does not match that of the custom element
-PASS document.createElement must report an exception thrown by a custom element constructor
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsDocumentcreateElementhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/Document-createElement.html (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/Document-createElement.html        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/fast/custom-elements/Document-createElement.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -1,331 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-<title>Custom Elements: Extensions to Document interface</title>
-<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
-<meta name="assert" content="document.createElement should instantiate a custom element">
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<link rel='stylesheet' href='../../resources/testharness.css'>
-<script src="resources/document-types.js"></script>
-</head>
-<body>
-<div id="log"></div>
-<script>
-setup({allow_uncaught_exception:true});
-
-test(function () {
- class MyCustomElement extends HTMLElement {};
-
- assert_true(document.createElement('my-custom-element') instanceof HTMLElement);
- assert_false(document.createElement('my-custom-element') instanceof MyCustomElement);
-
- customElements.define('my-custom-element', MyCustomElement);
- var instance = document.createElement('my-custom-element');
- assert_true(instance instanceof MyCustomElement);
- assert_equals(instance.localName, 'my-custom-element');
- assert_equals(instance.namespaceURI, 'http://www.w3.org/1999/xhtml', 'A custom element HTML must use HTML namespace');
-
-}, 'document.createElement must create an instance of custom elements');
-
-function assert_reports(expected, testFunction, message) {
- var uncaughtError = null;
- window.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
- testFunction();
- if (typeof(expected) == 'string')
- assert_equals(uncaughtError, expected, message);
- else if (expected && 'name' in expected)
- assert_equals(uncaughtError.name, expected.name, message);
- else
- assert_equals(uncaughtError, expected, message);
- window.onerror = null;
-}
-
-function assert_not_reports(testFunction, message) {
- assert_reports(null, testFunction, message);
-}
-
-test(function () {
- class ObjectCustomElement extends HTMLElement {
- constructor()
- {
- return {foo: 'bar'};
- }
- };
- customElements.define('object-custom-element', ObjectCustomElement);
-
- var instance = new ObjectCustomElement;
- assert_true(instance instanceof Object);
- assert_equals(instance.foo, 'bar');
-
- var instance;
- assert_reports({name: 'TypeError'}, function () { instance = document.createElement('object-custom-element'); });
- assert_equals(instance.localName, 'object-custom-element');
- assert_true(instance instanceof HTMLUnknownElement);
-}, 'document.createElement must report a TypeError when the result of Construct is not a DOM node');
-
-test(function () {
- class TextCustomElement extends HTMLElement {
- constructor()
- {
- return document.createTextNode('hello');
- }
- };
- customElements.define('text-custom-element', TextCustomElement);
- assert_true(new TextCustomElement instanceof Text);
- var instance;
- assert_reports({name: 'TypeError'}, function () { instance = document.createElement('text-custom-element'); });
- assert_equals(instance.localName, 'text-custom-element');
- assert_true(instance instanceof HTMLUnknownElement);
-}, 'document.createElement must report a TypeError when the result of Construct is a TextNode');
-
-test(function () {
- class ElementWithAttribute extends HTMLElement {
- constructor()
- {
- super();
- this.setAttribute('id', 'foo');
- }
- };
- customElements.define('element-with-attribute', ElementWithAttribute);
- assert_true(new ElementWithAttribute instanceof ElementWithAttribute);
- var instance;
- assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-attribute'); });
- assert_equals(instance.localName, 'element-with-attribute');
- assert_true(instance instanceof HTMLUnknownElement);
-}, 'document.createElement must report a NotSupportedError when attribute is added by setAttribute during construction');
-
-test(function () {
- class ElementWithAttrNode extends HTMLElement {
- constructor()
- {
- super();
- this.attributes.setNamedItem(document.createAttribute('title'));
- }
- };
- customElements.define('element-with-attr-node', ElementWithAttrNode);
- assert_true(new ElementWithAttrNode instanceof ElementWithAttrNode);
- var instance;
- assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-attr-node'); });
- assert_equals(instance.localName, 'element-with-attr-node');
- assert_true(instance instanceof HTMLUnknownElement);
-}, 'document.createElement must report a NotSupportedError when attribute is added by attributes.setNamedItem during construction');
-
-test(function () {
- class ElementWithNoAttributes extends HTMLElement {
- constructor()
- {
- super();
- this.attributes.setNamedItem(document.createAttribute('title'));
- this.removeAttribute('title');
- }
- };
- customElements.define('element-with-no-attiributes', ElementWithNoAttributes);
- assert_true(new ElementWithNoAttributes instanceof ElementWithNoAttributes);
- var instance;
- assert_not_reports(function () { instance = document.createElement('element-with-no-attiributes'); });
- assert_true(instance instanceof ElementWithNoAttributes);
-}, 'document.createElement must not report a NotSupportedError when attribute is added and removed during construction');
-
-test(function () {
- class ElementWithChildText extends HTMLElement {
- constructor()
- {
- super();
- this.appendChild(document.createTextNode('hello'));
- }
- };
- customElements.define('element-with-child-text', ElementWithChildText);
- assert_true(new ElementWithChildText instanceof ElementWithChildText);
- var instance;
- assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-child-text'); });
- assert_equals(instance.localName, 'element-with-child-text');
- assert_true(instance instanceof HTMLUnknownElement);
-}, 'document.createElement must report a NotSupportedError when a Text child is added during construction');
-
-test(function () {
- class ElementWithChildComment extends HTMLElement {
- constructor()
- {
- super();
- this.appendChild(document.createComment('hello'));
- }
- };
- customElements.define('element-with-child-comment', ElementWithChildComment);
- assert_true(new ElementWithChildComment instanceof ElementWithChildComment);
- var instance;
- assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-child-comment'); });
- assert_equals(instance.localName, 'element-with-child-comment');
- assert_true(instance instanceof HTMLUnknownElement);
-}, 'document.createElement must report a NotSupportedError when a Comment child is added during construction');
-
-test(function () {
- class ElementWithChildElement extends HTMLElement {
- constructor()
- {
- super();
- this.appendChild(document.createElement('div'));
- }
- };
- customElements.define('element-with-child-element', ElementWithChildElement);
- assert_true(new ElementWithChildElement instanceof ElementWithChildElement);
- var instance;
- assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-child-element'); });
- assert_equals(instance.localName, 'element-with-child-element');
- assert_true(instance instanceof HTMLUnknownElement);
-}, 'document.createElement must report a NotSupportedError when an element child is added during construction');
-
-test(function () {
- class ElementWithNoChildElements extends HTMLElement {
- constructor()
- {
- super();
- this.appendChild(document.createElement('div'));
- this.removeChild(this.firstChild);
- }
- };
- customElements.define('element-with-no-child-elements', ElementWithNoChildElements);
- var instance;
- assert_not_reports(function () { instance = document.createElement('element-with-no-child-elements'); });
- assert_true(instance instanceof ElementWithNoChildElements);
-}, 'document.createElement must not report a NotSupportedError when an element child is added and removed during construction');
-
-test(function () {
- class ElementWithParent extends HTMLElement {
- constructor()
- {
- super();
- document.createElement('div').appendChild(this);
- }
- };
- customElements.define('element-with-parent', ElementWithParent);
- assert_true(new ElementWithParent instanceof ElementWithParent);
- var instance;
- assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-parent'); });
- assert_equals(instance.localName, 'element-with-parent');
- assert_true(instance instanceof HTMLUnknownElement);
-}, 'document.createElement must report a NotSupportedError when the element gets inserted into another element during construction');
-
-test(function () {
- class ElementWithNoParent extends HTMLElement {
- constructor()
- {
- super();
- document.createElement('div').appendChild(this);
- this.parentNode.removeChild(this);
- }
- };
- customElements.define('element-with-no-parent', ElementWithNoParent);
- var instance;
- assert_not_reports(function () { instance = document.createElement('element-with-no-parent'); });
- assert_true(instance instanceof ElementWithNoParent);
-}, 'document.createElement must not report a NotSupportedError when the element is inserted and removed from another element during construction');
-
-DocumentTypes.forEach(function (entry, testNumber) {
- if (entry.isOwner)
- return;
-
- var getDocument = entry.create;
- var docuemntName = entry.name;
-
- promise_test(function () {
- return getDocument().then(function (doc) {
- class ElementWithAdoptCall extends HTMLElement {
- constructor()
- {
- super();
- doc.adoptNode(this);
- }
- };
- var name = 'element-with-adopt-call-' + testNumber;
- customElements.define(name, ElementWithAdoptCall);
- assert_true(new ElementWithAdoptCall instanceof ElementWithAdoptCall);
- var instance;
- assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement(name); });
- assert_equals(instance.localName, name);
- assert_true(instance instanceof HTMLUnknownElement);
- });
- }, 'document.createElement must report a NotSupportedError when the element is adopted into a ' + docuemntName + ' during construction');
-
- promise_test(function () {
- return getDocument().then(function (doc) {
- class ElementInsertedIntoAnotherDocument extends HTMLElement {
- constructor()
- {
- super();
- doc.documentElement.appendChild(this);
- }
- };
- var name = 'element-inserted-into-another-document-' + testNumber;
- customElements.define(name, ElementInsertedIntoAnotherDocument);
- assert_true(new ElementInsertedIntoAnotherDocument instanceof ElementInsertedIntoAnotherDocument);
- var instance;
- assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement(name); });
- assert_equals(instance.localName, name);
- assert_true(instance instanceof HTMLUnknownElement);
- });
- }, 'document.createElement must report a NotSupportedError when the element is inserted into a ' + docuemntName + ' during construction');
-
- promise_test(function () {
- return getDocument().then(function (doc) {
- class ElementThatGetAdoptedBack extends HTMLElement {
- constructor()
- {
- super();
- doc.adoptNode(this);
- document.adoptNode(this);
- }
- };
- var name = 'element-that-get-adopted-back' + testNumber;
- customElements.define(name, ElementThatGetAdoptedBack);
- var instance;
- assert_not_reports(function () { instance = document.createElement(name); });
- assert_true(instance instanceof ElementThatGetAdoptedBack);
- });
- }, 'document.createElement must not report a NotSupportedError when the element is adopted back from a ' + docuemntName + ' during construction');
-});
-
-test(function () {
- class DivCustomElement extends HTMLElement {
- constructor()
- {
- super();
- return document.createElement('div');
- }
- };
- customElements.define('div-custom-element', DivCustomElement);
- assert_true(new DivCustomElement instanceof HTMLDivElement);
- var instance;
- assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('div-custom-element'); });
- assert_equals(instance.localName, 'div-custom-element');
- assert_true(instance instanceof HTMLUnknownElement);
-}, 'document.createElement must report a NotSupportedError when the local name of the element does not match that of the custom element');
-
-test(function () {
- var exceptionToThrow = {name: 'exception thrown by a custom constructor'};
- class ThrowCustomElement extends HTMLElement {
- constructor()
- {
- super();
- if (exceptionToThrow)
- throw exceptionToThrow;
- }
- };
- customElements.define('throw-custom-element', ThrowCustomElement);
-
- assert_throws(exceptionToThrow, function () { new ThrowCustomElement; });
- var instance;
- assert_reports(exceptionToThrow, function () { instance = document.createElement('throw-custom-element'); });
- assert_equals(instance.localName, 'throw-custom-element');
- assert_true(instance instanceof HTMLUnknownElement);
-
- exceptionToThrow = false;
- var instance = document.createElement('throw-custom-element');
- assert_true(instance instanceof ThrowCustomElement);
- assert_equals(instance.localName, 'throw-custom-element');
-
-}, 'document.createElement must report an exception thrown by a custom element constructor');
-
-</script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsenqueuecustomelementupgradereactionexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/enqueue-custom-element-upgrade-reaction-expected.txt (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/enqueue-custom-element-upgrade-reaction-expected.txt        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/fast/custom-elements/enqueue-custom-element-upgrade-reaction-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -1,27 +0,0 @@
</span><del>-
-PASS Creating an element in document of a template element must not enqueue a custom element upgrade reaction because the document does not have a browsing context
-PASS Creating an element in document of a template element and inserting into the document must not enqueue a custom element upgrade reaction
-PASS Creating an element in document of a template element and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
-PASS Creating an element in new document must not enqueue a custom element upgrade reaction because the document does not have a browsing context
-PASS Creating an element in new document and inserting into the document must not enqueue a custom element upgrade reaction
-PASS Creating an element in new document and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
-PASS Creating an element in cloned document must not enqueue a custom element upgrade reaction because the document does not have a browsing context
-PASS Creating an element in cloned document and inserting into the document must not enqueue a custom element upgrade reaction
-PASS Creating an element in cloned document and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
-PASS Creating an element in document created by createHTMLDocument must not enqueue a custom element upgrade reaction because the document does not have a browsing context
-PASS Creating an element in document created by createHTMLDocument and inserting into the document must not enqueue a custom element upgrade reaction
-PASS Creating an element in document created by createHTMLDocument and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
-PASS Creating an element in HTML document created by createDocument must not enqueue a custom element upgrade reaction because the document does not have a browsing context
-PASS Creating an element in HTML document created by createDocument and inserting into the document must not enqueue a custom element upgrade reaction
-PASS Creating an element in HTML document created by createDocument and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
-PASS Creating an element in HTML document fetched by XHR must not enqueue a custom element upgrade reaction because the document does not have a browsing context
-PASS Creating an element in HTML document fetched by XHR and inserting into the document must not enqueue a custom element upgrade reaction
-PASS Creating an element in HTML document fetched by XHR and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
-PASS Creating an element in document in an iframe must not enqueue a custom element upgrade reaction if there is no matching definition
-PASS Creating an element in document in an iframe must enqueue a custom element upgrade reaction if there is a matching definition
-PASS "define" in document in an iframe must not enqueue a custom element upgrade reaction on a disconnected unresolved custom element
-PASS Inserting an unresolved custom element into document in an iframe must enqueue a custom element upgrade reaction
-PASS "define" in document in an iframe must enqueue a custom element upgrade reaction on a connected unresolved custom element
-PASS Adopting (and leaving disconnceted) an unresolved custom element into document in an iframe must not enqueue a custom element upgrade reaction
-PASS Adopting and inserting an unresolved custom element into document in an iframe must enqueue a custom element upgrade reaction
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastcustomelementsenqueuecustomelementupgradereactionhtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/custom-elements/enqueue-custom-element-upgrade-reaction.html (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/custom-elements/enqueue-custom-element-upgrade-reaction.html        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/fast/custom-elements/enqueue-custom-element-upgrade-reaction.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -1,189 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-<title>Custom Elements: Enqueue a custom element upgrade reaction</title>
-<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
-<meta name="assert" content="Enqueue a custom element upgrade reaction must upgrade a custom element">
-<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
-<link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#concept-try-upgrade">
-<link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-upgrade-reaction">
-<script src="../../resources/testharness.js"></script>
-<script src="../../resources/testharnessreport.js"></script>
-<link rel='stylesheet' href='../../resources/testharness.css'>
-<script src="resources/document-types.js"></script>
-</head>
-<body>
-<div id="log"></div>
-<script>
-
-class PredefinedCustomElement extends HTMLElement {}
-customElements.define('predefined-custom-element', PredefinedCustomElement);
-
-var customElementNumber = 1;
-function generateNextCustomElementName() { return 'custom-' + customElementNumber++; }
-
-DocumentTypes.filter(function (entry) { return !entry.isOwner && !entry.hasBrowsingContext; }).forEach(function (entry) {
- var documentName = entry.name;
- var getDocument = entry.create;
-
- promise_test(function () {
- return getDocument().then(function (doc) {
- assert_false(doc.createElement('predefined-custom-element') instanceof PredefinedCustomElement);
- });
- }, 'Creating an element in ' + documentName + ' must not enqueue a custom element upgrade reaction'
- + ' because the document does not have a browsing context');
-
- promise_test(function () {
- var name = generateNextCustomElementName();
- var unresolvedElement = document.createElement(name);
-
- assert_equals(unresolvedElement.__proto__, HTMLElement.prototype,
- '[[Prototype]] internal slot of the unresolved custom element must be the HTMLElement prototype');
-
- return getDocument().then(function (doc) {
- var unresolvedElementInDoc = doc.createElement(name);
- var prototype = (unresolvedElementInDoc.namespaceURI == 'http://www.w3.org/1999/xhtml' ? HTMLElement : Element).prototype;
-
- assert_equals(unresolvedElementInDoc.__proto__, prototype,
- '[[Prototype]] internal slot of the unresolved custom element must be the ' + prototype.toString() + ' prototype');
- var someCustomElement = class extends HTMLElement {};
- customElements.define(name, someCustomElement);
- assert_equals(unresolvedElementInDoc.__proto__, prototype, '"define" must not upgrade a disconnected unresolved custom elements');
- doc.documentElement.appendChild(unresolvedElementInDoc);
- assert_equals(unresolvedElementInDoc.__proto__, prototype,
- 'Inserting an element into a document without a browsing context must not enqueue a custom element upgrade reaction');
- });
- }, 'Creating an element in ' + documentName + ' and inserting into the document must not enqueue a custom element upgrade reaction');
-
- promise_test(function () {
- var name = generateNextCustomElementName();
- var unresolvedElement = document.createElement(name);
-
- assert_equals(unresolvedElement.__proto__, HTMLElement.prototype,
- '[[Prototype]] internal slot of the unresolved custom element must be the HTMLElement prototype');
-
- return getDocument().then(function (doc) {
- var unresolvedElementInDoc = doc.createElement(name);
- var prototype = (unresolvedElementInDoc.namespaceURI == 'http://www.w3.org/1999/xhtml' ? HTMLElement : Element).prototype;
-
- assert_equals(unresolvedElementInDoc.__proto__, prototype,
- '[[Prototype]] internal slot of the unresolved custom element must be the ' + prototype.toString() + ' prototype');
- var someCustomElement = class extends HTMLElement {};
- customElements.define(name, someCustomElement);
- assert_equals(unresolvedElementInDoc.__proto__, prototype, '"define" must not upgrade a disconnected unresolved custom elements');
- document.body.appendChild(unresolvedElementInDoc);
-
- if (unresolvedElementInDoc.namespaceURI == 'http://www.w3.org/1999/xhtml') {
- assert_equals(unresolvedElementInDoc.__proto__, someCustomElement.prototype,
- 'Inserting an element into a document with a browsing context must enqueue a custom element upgrade reaction');
- } else {
- assert_equals(unresolvedElementInDoc.__proto__, prototype,
- 'Looking up a custom element definition must return null if the element is not in the HTML namespace');
- }
- });
- }, 'Creating an element in ' + documentName + ' and adopting back to a document with browsing context must enqueue a custom element upgrade reaction');
-
-});
-
-DocumentTypes.filter(function (entry) { return !entry.isOwner && entry.hasBrowsingContext; }).forEach(function (entry) {
- var documentName = entry.name;
- var getDocument = entry.create;
-
- promise_test(function () {
- return getDocument().then(function (doc) {
- assert_false(doc.createElement('predefined-custom-element') instanceof PredefinedCustomElement);
- });
- }, 'Creating an element in ' + documentName + ' must not enqueue a custom element upgrade reaction if there is no matching definition');
-
- promise_test(function () {
- return getDocument().then(function (doc) {
- var docWindow = doc.defaultView;
- class DistinctPredefinedCustomElement extends docWindow.HTMLElement { };
- docWindow.customElements.define('predefined-custom-element', DistinctPredefinedCustomElement);
- assert_true(doc.createElement('predefined-custom-element') instanceof DistinctPredefinedCustomElement);
- });
- }, 'Creating an element in ' + documentName + ' must enqueue a custom element upgrade reaction if there is a matching definition');
-
- promise_test(function () {
- var unresolvedElement = document.createElement('unresolved-element');
- return getDocument().then(function (doc) {
- var docWindow = doc.defaultView;
- class UnresolvedElement extends docWindow.HTMLElement { };
- var unresolvedElementInDoc = doc.createElement('unresolved-element');
-
- assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
- assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype);
-
- docWindow.customElements.define('unresolved-element', UnresolvedElement);
-
- assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
- assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype);
-
- });
- }, '"define" in ' + documentName + ' must not enqueue a custom element upgrade reaction on a disconnected unresolved custom element');
-
- promise_test(function () {
- var unresolvedElement = document.createElement('unresolved-element');
- return getDocument().then(function (doc) {
- var docWindow = doc.defaultView;
- class UnresolvedElement extends docWindow.HTMLElement { };
- var unresolvedElementInDoc = doc.createElement('unresolved-element');
-
- assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
- assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype);
-
- docWindow.customElements.define('unresolved-element', UnresolvedElement);
- doc.documentElement.appendChild(unresolvedElementInDoc);
-
- assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
- assert_equals(unresolvedElementInDoc.__proto__, UnresolvedElement.prototype);
- });
- }, 'Inserting an unresolved custom element into ' + documentName + ' must enqueue a custom element upgrade reaction');
-
- promise_test(function () {
- var unresolvedElement = document.createElement('unresolved-element');
- return getDocument().then(function (doc) {
- var docWindow = doc.defaultView;
- class UnresolvedElement extends docWindow.HTMLElement { };
- var unresolvedElementInDoc = doc.createElement('unresolved-element');
- doc.documentElement.appendChild(unresolvedElementInDoc);
-
- assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
- assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype);
-
- docWindow.customElements.define('unresolved-element', UnresolvedElement);
-
- assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
- assert_equals(unresolvedElementInDoc.__proto__, UnresolvedElement.prototype);
- });
- }, '"define" in ' + documentName + ' must enqueue a custom element upgrade reaction on a connected unresolved custom element');
-
- promise_test(function () {
- var unresolvedElement = document.createElement('unresolved-element');
- return getDocument().then(function (doc) {
- var docWindow = doc.defaultView;
- class UnresolvedElement extends docWindow.HTMLElement { };
- assert_false(unresolvedElement instanceof UnresolvedElement);
- docWindow.customElements.define('unresolved-element', UnresolvedElement);
- doc.adoptNode(unresolvedElement);
- assert_false(unresolvedElement instanceof UnresolvedElement);
- });
- }, 'Adopting (and leaving disconnceted) an unresolved custom element into ' + documentName + ' must not enqueue a custom element upgrade reaction');
-
- promise_test(function () {
- var unresolvedElement = document.createElement('unresolved-element');
- return getDocument().then(function (doc) {
- var docWindow = doc.defaultView;
- class UnresolvedElement extends docWindow.HTMLElement { };
- assert_false(unresolvedElement instanceof UnresolvedElement);
- docWindow.customElements.define('unresolved-element', UnresolvedElement);
- doc.documentElement.appendChild(unresolvedElement);
- assert_true(unresolvedElement instanceof UnresolvedElement);
- });
- }, 'Adopting and inserting an unresolved custom element into ' + documentName + ' must enqueue a custom element upgrade reaction');
-
-});
-
-</script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-10-21 Ryosuke Niwa <rniwa@webkit.org>
+
+ Update custom elements tests
+ https://bugs.webkit.org/show_bug.cgi?id=163815
+
+ Reviewed by Joseph Pecoraro.
+
+ Re-import the custom elements as of 5078aa44879c87c38b6430670583951dbeae3025.
+
+ * web-platform-tests/custom-elements/Document-createElement-expected.txt: Moved from from fast/custom-elements/Document-createElement.html.
+ * web-platform-tests/custom-elements/Document-createElement.html: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write-expected.txt: Moved from from fast/custom-elements/parser/.
+ * web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write.html: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously.html: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-constructs-custom-elements-expected.txt: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-constructs-custom-elements.html: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element-expected.txt: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element.html: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-uses-constructed-element-expected.txt: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-uses-constructed-element.html: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt: Ditto.
+ * web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document.html: Ditto.
+ * web-platform-tests/custom-elements/parser/w3c-import.log: Added.
+ * web-platform-tests/custom-elements/reactions/DOMTokenList-expected.txt:
+ * web-platform-tests/custom-elements/reactions/DOMTokenList.html:
+ * web-platform-tests/custom-elements/reactions/Document-expected.txt:
+ * web-platform-tests/custom-elements/reactions/Document.html:
+ * web-platform-tests/custom-elements/reactions/Range-expected.txt:
+ * web-platform-tests/custom-elements/reactions/resources/reactions.js:
+ * web-platform-tests/custom-elements/upgrading-expected.txt: Added.
+ * web-platform-tests/custom-elements/upgrading.html: Moved from fast/custom-elements/enqueue-custom-element-upgrade-reaction.html.
+ * web-platform-tests/custom-elements/upgrading/Node-cloneNode-expected.txt: Moved from fast/custom-elements/upgrading/.
+ * web-platform-tests/custom-elements/upgrading/Node-cloneNode.html: Ditto.
+ * web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element-expected.txt: Ditto.
+ * web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element.html: Ditto.
+ * web-platform-tests/custom-elements/upgrading/w3c-import.log: Added.
+ * web-platform-tests/custom-elements/w3c-import.log:
+
</ins><span class="cx"> 2016-10-20 Zan Dobersek <zdobersek@igalia.com>
</span><span class="cx">
</span><span class="cx"> Import W3C EME tests
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsDocumentcreateElementexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement-expected.txt (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+CONSOLE MESSAGE: line 225: ReferenceError: Can't find variable: document_types
+
+PASS document.createElement must create an instance of custom elements
+PASS document.createElement must report a TypeError when the result of Construct is not a DOM node
+PASS document.createElement must report a TypeError when the result of Construct is a TextNode
+PASS document.createElement must report a NotSupportedError when attribute is added by setAttribute during construction
+PASS document.createElement must report a NotSupportedError when attribute is added by attributes.setNamedItem during construction
+PASS document.createElement must not report a NotSupportedError when attribute is added and removed during construction
+PASS document.createElement must report a NotSupportedError when a Text child is added during construction
+PASS document.createElement must report a NotSupportedError when a Comment child is added during construction
+PASS document.createElement must report a NotSupportedError when an element child is added during construction
+PASS document.createElement must not report a NotSupportedError when an element child is added and removed during construction
+PASS document.createElement must report a NotSupportedError when the element gets inserted into another element during construction
+PASS document.createElement must not report a NotSupportedError when the element is inserted and removed from another element during construction
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsDocumentcreateElementhtmlfromrev207702trunkLayoutTestsfastcustomelementsDocumentcreateElementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/Document-createElement.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,332 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: document.createElement should create an element with synchronous custom elements flag set</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="document.createElement should create an element with synchronous custom elements flag set">
+<link rel="help" content="https://dom.spec.whatwg.org/#dom-document-createelement">
+<link rel="help" content="https://dom.spec.whatwg.org/#concept-create-element">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="resources/custom-elements-helper.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+setup({allow_uncaught_exception:true});
+
+test(function () {
+ class MyCustomElement extends HTMLElement {};
+
+ assert_true(document.createElement('my-custom-element') instanceof HTMLElement);
+ assert_false(document.createElement('my-custom-element') instanceof MyCustomElement);
+
+ customElements.define('my-custom-element', MyCustomElement);
+ var instance = document.createElement('my-custom-element');
+ assert_true(instance instanceof MyCustomElement);
+ assert_equals(instance.localName, 'my-custom-element');
+ assert_equals(instance.namespaceURI, 'http://www.w3.org/1999/xhtml', 'A custom element HTML must use HTML namespace');
+
+}, 'document.createElement must create an instance of custom elements');
+
+function assert_reports(expected, testFunction, message) {
+ var uncaughtError = null;
+ window.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
+ testFunction();
+ if (typeof(expected) == 'string')
+ assert_equals(uncaughtError, expected, message);
+ else if (expected && 'name' in expected)
+ assert_equals(uncaughtError.name, expected.name, message);
+ else
+ assert_equals(uncaughtError, expected, message);
+ window.onerror = null;
+}
+
+function assert_not_reports(testFunction, message) {
+ assert_reports(null, testFunction, message);
+}
+
+test(function () {
+ class ObjectCustomElement extends HTMLElement {
+ constructor()
+ {
+ return {foo: 'bar'};
+ }
+ };
+ customElements.define('object-custom-element', ObjectCustomElement);
+
+ var instance = new ObjectCustomElement;
+ assert_true(instance instanceof Object);
+ assert_equals(instance.foo, 'bar');
+
+ var instance;
+ assert_reports({name: 'TypeError'}, function () { instance = document.createElement('object-custom-element'); });
+ assert_equals(instance.localName, 'object-custom-element');
+ assert_true(instance instanceof HTMLUnknownElement);
+}, 'document.createElement must report a TypeError when the result of Construct is not a DOM node');
+
+test(function () {
+ class TextCustomElement extends HTMLElement {
+ constructor()
+ {
+ return document.createTextNode('hello');
+ }
+ };
+ customElements.define('text-custom-element', TextCustomElement);
+ assert_true(new TextCustomElement instanceof Text);
+ var instance;
+ assert_reports({name: 'TypeError'}, function () { instance = document.createElement('text-custom-element'); });
+ assert_equals(instance.localName, 'text-custom-element');
+ assert_true(instance instanceof HTMLUnknownElement);
+}, 'document.createElement must report a TypeError when the result of Construct is a TextNode');
+
+test(function () {
+ class ElementWithAttribute extends HTMLElement {
+ constructor()
+ {
+ super();
+ this.setAttribute('id', 'foo');
+ }
+ };
+ customElements.define('element-with-attribute', ElementWithAttribute);
+ assert_true(new ElementWithAttribute instanceof ElementWithAttribute);
+ var instance;
+ assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-attribute'); });
+ assert_equals(instance.localName, 'element-with-attribute');
+ assert_true(instance instanceof HTMLUnknownElement);
+}, 'document.createElement must report a NotSupportedError when attribute is added by setAttribute during construction');
+
+test(function () {
+ class ElementWithAttrNode extends HTMLElement {
+ constructor()
+ {
+ super();
+ this.attributes.setNamedItem(document.createAttribute('title'));
+ }
+ };
+ customElements.define('element-with-attr-node', ElementWithAttrNode);
+ assert_true(new ElementWithAttrNode instanceof ElementWithAttrNode);
+ var instance;
+ assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-attr-node'); });
+ assert_equals(instance.localName, 'element-with-attr-node');
+ assert_true(instance instanceof HTMLUnknownElement);
+}, 'document.createElement must report a NotSupportedError when attribute is added by attributes.setNamedItem during construction');
+
+test(function () {
+ class ElementWithNoAttributes extends HTMLElement {
+ constructor()
+ {
+ super();
+ this.attributes.setNamedItem(document.createAttribute('title'));
+ this.removeAttribute('title');
+ }
+ };
+ customElements.define('element-with-no-attiributes', ElementWithNoAttributes);
+ assert_true(new ElementWithNoAttributes instanceof ElementWithNoAttributes);
+ var instance;
+ assert_not_reports(function () { instance = document.createElement('element-with-no-attiributes'); });
+ assert_true(instance instanceof ElementWithNoAttributes);
+}, 'document.createElement must not report a NotSupportedError when attribute is added and removed during construction');
+
+test(function () {
+ class ElementWithChildText extends HTMLElement {
+ constructor()
+ {
+ super();
+ this.appendChild(document.createTextNode('hello'));
+ }
+ };
+ customElements.define('element-with-child-text', ElementWithChildText);
+ assert_true(new ElementWithChildText instanceof ElementWithChildText);
+ var instance;
+ assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-child-text'); });
+ assert_equals(instance.localName, 'element-with-child-text');
+ assert_true(instance instanceof HTMLUnknownElement);
+}, 'document.createElement must report a NotSupportedError when a Text child is added during construction');
+
+test(function () {
+ class ElementWithChildComment extends HTMLElement {
+ constructor()
+ {
+ super();
+ this.appendChild(document.createComment('hello'));
+ }
+ };
+ customElements.define('element-with-child-comment', ElementWithChildComment);
+ assert_true(new ElementWithChildComment instanceof ElementWithChildComment);
+ var instance;
+ assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-child-comment'); });
+ assert_equals(instance.localName, 'element-with-child-comment');
+ assert_true(instance instanceof HTMLUnknownElement);
+}, 'document.createElement must report a NotSupportedError when a Comment child is added during construction');
+
+test(function () {
+ class ElementWithChildElement extends HTMLElement {
+ constructor()
+ {
+ super();
+ this.appendChild(document.createElement('div'));
+ }
+ };
+ customElements.define('element-with-child-element', ElementWithChildElement);
+ assert_true(new ElementWithChildElement instanceof ElementWithChildElement);
+ var instance;
+ assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-child-element'); });
+ assert_equals(instance.localName, 'element-with-child-element');
+ assert_true(instance instanceof HTMLUnknownElement);
+}, 'document.createElement must report a NotSupportedError when an element child is added during construction');
+
+test(function () {
+ class ElementWithNoChildElements extends HTMLElement {
+ constructor()
+ {
+ super();
+ this.appendChild(document.createElement('div'));
+ this.removeChild(this.firstChild);
+ }
+ };
+ customElements.define('element-with-no-child-elements', ElementWithNoChildElements);
+ var instance;
+ assert_not_reports(function () { instance = document.createElement('element-with-no-child-elements'); });
+ assert_true(instance instanceof ElementWithNoChildElements);
+}, 'document.createElement must not report a NotSupportedError when an element child is added and removed during construction');
+
+test(function () {
+ class ElementWithParent extends HTMLElement {
+ constructor()
+ {
+ super();
+ document.createElement('div').appendChild(this);
+ }
+ };
+ customElements.define('element-with-parent', ElementWithParent);
+ assert_true(new ElementWithParent instanceof ElementWithParent);
+ var instance;
+ assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('element-with-parent'); });
+ assert_equals(instance.localName, 'element-with-parent');
+ assert_true(instance instanceof HTMLUnknownElement);
+}, 'document.createElement must report a NotSupportedError when the element gets inserted into another element during construction');
+
+test(function () {
+ class ElementWithNoParent extends HTMLElement {
+ constructor()
+ {
+ super();
+ document.createElement('div').appendChild(this);
+ this.parentNode.removeChild(this);
+ }
+ };
+ customElements.define('element-with-no-parent', ElementWithNoParent);
+ var instance;
+ assert_not_reports(function () { instance = document.createElement('element-with-no-parent'); });
+ assert_true(instance instanceof ElementWithNoParent);
+}, 'document.createElement must not report a NotSupportedError when the element is inserted and removed from another element during construction');
+
+document_types().forEach(function (entry, testNumber) {
+ if (entry.isOwner)
+ return;
+
+ var getDocument = entry.create;
+ var docuemntName = entry.name;
+
+ promise_test(function () {
+ return getDocument().then(function (doc) {
+ class ElementWithAdoptCall extends HTMLElement {
+ constructor()
+ {
+ super();
+ doc.adoptNode(this);
+ }
+ };
+ var name = 'element-with-adopt-call-' + testNumber;
+ customElements.define(name, ElementWithAdoptCall);
+ assert_true(new ElementWithAdoptCall instanceof ElementWithAdoptCall);
+ var instance;
+ assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement(name); });
+ assert_equals(instance.localName, name);
+ assert_true(instance instanceof HTMLUnknownElement);
+ });
+ }, 'document.createElement must report a NotSupportedError when the element is adopted into a ' + docuemntName + ' during construction');
+
+ promise_test(function () {
+ return getDocument().then(function (doc) {
+ class ElementInsertedIntoAnotherDocument extends HTMLElement {
+ constructor()
+ {
+ super();
+ doc.documentElement.appendChild(this);
+ }
+ };
+ var name = 'element-inserted-into-another-document-' + testNumber;
+ customElements.define(name, ElementInsertedIntoAnotherDocument);
+ assert_true(new ElementInsertedIntoAnotherDocument instanceof ElementInsertedIntoAnotherDocument);
+ var instance;
+ assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement(name); });
+ assert_equals(instance.localName, name);
+ assert_true(instance instanceof HTMLUnknownElement);
+ });
+ }, 'document.createElement must report a NotSupportedError when the element is inserted into a ' + docuemntName + ' during construction');
+
+ promise_test(function () {
+ return getDocument().then(function (doc) {
+ class ElementThatGetAdoptedBack extends HTMLElement {
+ constructor()
+ {
+ super();
+ doc.adoptNode(this);
+ document.adoptNode(this);
+ }
+ };
+ var name = 'element-that-get-adopted-back' + testNumber;
+ customElements.define(name, ElementThatGetAdoptedBack);
+ var instance;
+ assert_not_reports(function () { instance = document.createElement(name); });
+ assert_true(instance instanceof ElementThatGetAdoptedBack);
+ });
+ }, 'document.createElement must not report a NotSupportedError when the element is adopted back from a ' + docuemntName + ' during construction');
+});
+
+test(function () {
+ class DivCustomElement extends HTMLElement {
+ constructor()
+ {
+ super();
+ return document.createElement('div');
+ }
+ };
+ customElements.define('div-custom-element', DivCustomElement);
+ assert_true(new DivCustomElement instanceof HTMLDivElement);
+ var instance;
+ assert_reports({name: 'NotSupportedError'}, function () { instance = document.createElement('div-custom-element'); });
+ assert_equals(instance.localName, 'div-custom-element');
+ assert_true(instance instanceof HTMLUnknownElement);
+}, 'document.createElement must report a NotSupportedError when the local name of the element does not match that of the custom element');
+
+test(function () {
+ var exceptionToThrow = {name: 'exception thrown by a custom constructor'};
+ class ThrowCustomElement extends HTMLElement {
+ constructor()
+ {
+ super();
+ if (exceptionToThrow)
+ throw exceptionToThrow;
+ }
+ };
+ customElements.define('throw-custom-element', ThrowCustomElement);
+
+ assert_throws(exceptionToThrow, function () { new ThrowCustomElement; });
+ var instance;
+ assert_reports(exceptionToThrow, function () { instance = document.createElement('throw-custom-element'); });
+ assert_equals(instance.localName, 'throw-custom-element');
+ assert_true(instance instanceof HTMLUnknownElement);
+
+ exceptionToThrow = false;
+ var instance = document.createElement('throw-custom-element');
+ assert_true(instance instanceof ThrowCustomElement);
+ assert_equals(instance.localName, 'throw-custom-element');
+
+}, 'document.createElement must report an exception thrown by a custom element constructor');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementindocumentwriteexpectedtxtfromrev207702trunkLayoutTestsfastcustomelementsparserparserconstructscustomelementindocumentwriteexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write-expected.txt (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-in-document-write-expected.txt) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS HTML parser must instantiate custom elements inside document.write
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementindocumentwritehtmlfromrev207702trunkLayoutTestsfastcustomelementsparserparserconstructscustomelementindocumentwritehtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-in-document-write.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Changes to the HTML parser</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="HTML parser must construct custom elements inside document.write">
+<link rel="help" href="https://html.spec.whatwg.org/#create-an-element-for-the-token">
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
+<link rel="help" href="https://html.spec.whatwg.org/#document.write()">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+class MyCustomElement extends HTMLElement { }
+customElements.define('my-custom-element', MyCustomElement);
+
+document.write('<my-custom-element></my-custom-element>');
+
+test(function () {
+ var instance = document.querySelector('my-custom-element');
+
+ assert_true(instance instanceof HTMLElement);
+ assert_true(instance instanceof MyCustomElement);
+
+}, 'HTML parser must instantiate custom elements inside document.write');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementsynchronouslyexpectedtxtfromrev207702trunkLayoutTestsfastcustomelementsparserparserconstructscustomelementsynchronouslyexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+
+PASS HTML parser must only append nodes that appear before a custom element before instantiating the custom element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementsynchronouslyhtmlfromrev207702trunkLayoutTestsfastcustomelementsparserparserconstructscustomelementsynchronouslyhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-element-synchronously.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,51 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Changes to the HTML parser</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="HTML parser must construct a custom element synchronously">
+<link rel="help" href="https://html.spec.whatwg.org/#create-an-element-for-the-token">
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+var childElementCountInConstructor;
+var containerChildNodesInConstructor = [];
+var containerNextSiblingInConstructor;
+class MyCustomElement extends HTMLElement {
+ constructor() {
+ super();
+ var container = document.getElementById('custom-element-container');
+ for (var i = 0; i < container.childNodes.length; i++)
+ containerChildNodesInConstructor.push(container.childNodes[i]);
+ containerNextSiblingInConstructor = container.nextSibling;
+ }
+};
+customElements.define('my-custom-element', MyCustomElement);
+
+</script>
+<div id="custom-element-container">
+ <span id="custom-element-previous-element"></span>
+ <my-custom-element></my-custom-element>
+ <div id="custom-element-next-element"></div>
+</div>
+<script>
+
+test(function () {
+ var instance = document.querySelector('my-custom-element');
+
+ assert_equals(containerChildNodesInConstructor.length, 3);
+ assert_equals(containerChildNodesInConstructor[0], instance.parentNode.firstChild);
+ assert_equals(containerChildNodesInConstructor[1], document.getElementById('custom-element-previous-element'));
+ assert_equals(containerChildNodesInConstructor[2], instance.previousSibling);
+ assert_equals(containerNextSiblingInConstructor, null);
+
+}, 'HTML parser must only append nodes that appear before a custom element before instantiating the custom element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementsexpectedtxtfromrev207702trunkLayoutTestsfastcustomelementsparserparserconstructscustomelementsexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-elements-expected.txt (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-elements-expected.txt) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-elements-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-elements-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+PASS HTML parser must NOT create a custom element before customElements.define is called
+PASS HTML parser must create a defined custom element before executing inline scripts
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserconstructscustomelementshtmlfromrev207702trunkLayoutTestsfastcustomelementsparserparserconstructscustomelementshtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-elements.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-constructs-custom-elements.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-elements.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-elements.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Changes to the HTML parser</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="HTML parser creates a custom element">
+<link rel="help" href="https://html.spec.whatwg.org/#create-an-element-for-the-token">
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<my-custom-element id="instance1"></my-custom-element>
+<script>
+
+class MyCustomElement extends HTMLElement { };
+
+test(function () {
+ var customElement = document.getElementById('instance1');
+
+ assert_true(customElement instanceof HTMLElement, 'An unresolved custom element must be an instance of HTMLElement');
+ assert_false(customElement instanceof MyCustomElement, 'An unresolved custom element must NOT be an instance of that custom element');
+ assert_equals(customElement.localName, 'my-custom-element');
+ assert_equals(customElement.namespaceURI, 'http://www.w3.org/1999/xhtml', 'A custom element HTML must use HTML namespace');
+
+}, 'HTML parser must NOT create a custom element before customElements.define is called');
+
+customElements.define('my-custom-element', MyCustomElement);
+
+</script>
+<my-custom-element id="instance2"></my-custom-element>
+<script>
+
+test(function () {
+ var customElement = document.getElementById('instance2');
+
+ assert_true(customElement instanceof HTMLElement, 'A resolved custom element must be an instance of HTMLElement');
+ assert_false(customElement instanceof HTMLUnknownElement, 'A resolved custom element must NOT be an instance of HTMLUnknownElement');
+ assert_true(customElement instanceof MyCustomElement, 'A resolved custom element must be an instance of that custom element');
+ assert_equals(customElement.localName, 'my-custom-element');
+ assert_equals(customElement.namespaceURI, 'http://www.w3.org/1999/xhtml', 'A custom element HTML must use HTML namespace');
+
+}, 'HTML parser must create a defined custom element before executing inline scripts');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserfallsbacktounknownelementexpectedtxtfromrev207702trunkLayoutTestsfastcustomelementsparserparserfallsbacktounknownelementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element-expected.txt (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-fallsback-to-unknown-element-expected.txt) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+CONSOLE MESSAGE: TypeError: The result of constructing a custom element must be a HTMLElement
+CONSOLE MESSAGE: TypeError: The result of constructing a custom element must be a HTMLElement
+CONSOLE MESSAGE: line 35: ReferenceError: Cannot access uninitialized variable.
+CONSOLE MESSAGE: line 41: Bad
+
+PASS HTML parser must create a fallback HTMLUnknownElement when a custom element constructor returns a Text node
+PASS HTML parser must create a fallback HTMLUnknownElement when a custom element constructor returns non-Element object
+PASS HTML parser must create a fallback HTMLUnknownElement when a custom element constructor does not call super()
+PASS HTML parser must create a fallback HTMLUnknownElement when a custom element constructor throws an exception
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserfallsbacktounknownelementhtmlfromrev207702trunkLayoutTestsfastcustomelementsparserparserfallsbacktounknownelementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-fallsback-to-unknown-element.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Changes to the HTML parser</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="HTML parser must fallback to creating a HTMLUnknownElement when a custom element construction fails">
+<link rel="help" href="https://html.spec.whatwg.org/#create-an-element-for-the-token">
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+setup({allow_uncaught_exception:true});
+
+class ReturnsTextNode extends HTMLElement {
+ constructor() {
+ super();
+ return document.createTextNode('some text');
+ }
+};
+customElements.define('returns-text', ReturnsTextNode);
+
+class ReturnsNonElementObject extends HTMLElement {
+ constructor() {
+ super();
+ return {};
+ }
+};
+customElements.define('returns-non-element-object', ReturnsNonElementObject);
+
+class LacksSuperCall extends HTMLElement {
+ constructor() { }
+};
+customElements.define('lacks-super-call', LacksSuperCall);
+
+class ThrowsException extends HTMLElement {
+ constructor() {
+ throw 'Bad';
+ }
+};
+customElements.define('throws-exception', ThrowsException);
+
+</script>
+<returns-text></returns-text>
+<returns-non-element-object></returns-non-element-object>
+<lacks-super-call></lacks-super-call>
+<throws-exception></throws-exception>
+<script>
+
+test(function () {
+ var instance = document.querySelector('returns-text');
+
+ assert_false(instance instanceof ReturnsTextNode, 'HTML parser must NOT instantiate a custom element when the constructor returns a Text node');
+ assert_true(instance instanceof HTMLElement, 'The fallback element created by HTML parser must be an instance of HTMLElement');
+ assert_true(instance instanceof HTMLUnknownElement, 'The fallback element created by HTML parser must be an instance of HTMLUnknownElement');
+
+}, 'HTML parser must create a fallback HTMLUnknownElement when a custom element constructor returns a Text node');
+
+test(function () {
+ var instance = document.querySelector('returns-non-element-object');
+
+ assert_false(instance instanceof ReturnsNonElementObject, 'HTML parser must NOT instantiate a custom element when the constructor returns a non-Element object');
+ assert_true(instance instanceof HTMLElement, 'The fallback element created by HTML parser must be an instance of HTMLElement');
+ assert_true(instance instanceof HTMLUnknownElement, 'The fallback element created by HTML parser must be an instance of HTMLUnknownElement');
+
+}, 'HTML parser must create a fallback HTMLUnknownElement when a custom element constructor returns non-Element object');
+
+test(function () {
+ var instance = document.querySelector('lacks-super-call');
+
+ assert_false(instance instanceof LacksSuperCall, 'HTML parser must NOT instantiate a custom element when the constructor does not call super()');
+ assert_true(instance instanceof HTMLElement, 'The fallback element created by HTML parser must be an instance of HTMLElement');
+ assert_true(instance instanceof HTMLUnknownElement, 'The fallback element created by HTML parser must be an instance of HTMLUnknownElement');
+
+}, 'HTML parser must create a fallback HTMLUnknownElement when a custom element constructor does not call super()');
+
+test(function () {
+ var instance = document.querySelector('throws-exception');
+
+ assert_false(instance instanceof ThrowsException, 'HTML parser must NOT instantiate a custom element when the constructor throws an exception');
+ assert_true(instance instanceof HTMLElement, 'The fallback element created by HTML parser must be an instance of HTMLElement');
+ assert_true(instance instanceof HTMLUnknownElement, 'The fallback element created by HTML parser must be an instance of HTMLUnknownElement');
+
+}, 'HTML parser must create a fallback HTMLUnknownElement when a custom element constructor throws an exception');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparsersetsattributesandchildrenexpectedtxtfromrev207702trunkLayoutTestsfastcustomelementsparserparsersetsattributesandchildrenexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-sets-attributes-and-children-expected.txt) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+
+PASS HTML parser must set the attributes
+PASS HTML parser must append child nodes
+PASS HTML parser must set the attributes or append children before calling constructor
+hello world
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparsersetsattributesandchildrenhtmlfromrev207702trunkLayoutTestsfastcustomelementsparserparsersetsattributesandchildrenhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-sets-attributes-and-children.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Changes to the HTML parser</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="HTML parser must set the attributes and append the children on a custom element">
+<link rel="help" href="https://html.spec.whatwg.org/#create-an-element-for-the-token">
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+var numberOfAttributesInConstructor;
+var numberOfChildNodesInConstructor;
+
+class MyCustomElement extends HTMLElement {
+ constructor(...args) {
+ super(...args);
+ numberOfAttributesInConstructor = this.attributes.length;
+ numberOfChildNodesInConstructor = this.childNodes.length;
+ }
+};
+customElements.define('my-custom-element', MyCustomElement);
+
+</script>
+<my-custom-element id="custom-element-id" class="class1 class2">hello <b>world</b></my-custom-element>
+<script>
+
+var customElement = document.querySelector('my-custom-element');
+
+test(function () {
+ assert_equals(customElement.getAttribute('id'), 'custom-element-id', 'HTML parser must preserve the id attribute');
+ assert_equals(customElement.id, 'custom-element-id', 'HTML parser must preserve the semantics of reflect for the id attribute');
+ assert_equals(customElement.getAttribute('class'), 'class1 class2', 'HTML parser must preserve the class attribute');
+ assert_equals(customElement.classList.length, 2, 'HTML parser must initialize classList on custom elements');
+ assert_equals(customElement.classList[0], 'class1', 'HTML parser must initialize classList on custom elements');
+ assert_equals(customElement.classList[1], 'class2', 'HTML parser must initialize classList on custom elements');
+}, 'HTML parser must set the attributes');
+
+test(function () {
+ assert_equals(customElement.childNodes.length, 2, 'HTML parser must append child nodes');
+ assert_true(customElement.firstChild instanceof Text, 'HTML parser must append Text node child to a custom element');
+ assert_equals(customElement.firstChild.data, 'hello ', 'HTML parser must append Text node child to a custom element');
+ assert_true(customElement.lastChild instanceof HTMLElement, 'HTML parser must append a builtin element child to a custom element');
+ assert_true(customElement.lastChild.firstChild instanceof Text, 'HTML parser must preserve grandchild nodes of a custom element');
+ assert_equals(customElement.lastChild.firstChild.data, 'world', 'HTML parser must preserve grandchild nodes of a custom element');
+}, 'HTML parser must append child nodes');
+
+test(function () {
+ assert_equals(numberOfAttributesInConstructor, 0, 'HTML parser must not set attributes on a custom element before invoking the constructor');
+ assert_equals(numberOfChildNodesInConstructor, 0, 'HTML parser must not append child nodes to a custom element before invoking the constructor');
+}, 'HTML parser must set the attributes or append children before calling constructor');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserusesconstructedelementexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-constructed-element-expected.txt (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-constructed-element-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-constructed-element-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+
+FAIL HTML parser must use the returned value of the custom element constructor instead of the one created before super() call assert_equals: expected (string) "HTML parser must insert the synchronously constructed custom element" but got (boolean) true
+FAIL HTML parser must use the returned value of the custom element constructor instead using the one created in super() call assert_equals: expected (string) "HTML parser must insert the synchronously constructed custom element" but got (boolean) true
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserusesconstructedelementhtmlfromrev207702trunkLayoutTestsfastcustomelementsparserparserusesconstructedelementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-constructed-element.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-uses-constructed-element.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-constructed-element.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-constructed-element.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,75 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: HTML parser must construct a custom element instead of upgrading</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="HTML parser must construct a custom element instead of upgrading">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<link rel="help" href="https://html.spec.whatwg.org/#create-an-element-for-the-token">
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+let anotherElementCreatedBeforeSuperCall = undefined;
+let elementCreatedBySuperCall = undefined;
+let shouldCreateElementBeforeSuperCall = true;
+class InstantiatesItselfBeforeSuper extends HTMLElement {
+ constructor() {
+ if (shouldCreateElementBeforeSuperCall) {
+ shouldCreateElementBeforeSuperCall = false;
+ anotherElementCreatedBeforeSuperCall = new InstantiatesItselfBeforeSuper();
+ }
+ super();
+ elementCreatedBySuperCall = this;
+ }
+};
+customElements.define('instantiates-itself-before-super', InstantiatesItselfBeforeSuper);
+
+let shouldCreateAnotherInstance = true;
+let anotherInstance = undefined;
+let firstInstance = undefined;
+class ReturnsAnotherInstance extends HTMLElement {
+ constructor() {
+ super();
+ if (shouldCreateAnotherInstance) {
+ shouldCreateAnotherInstance = false;
+ firstInstance = this;
+ anotherInstance = new ReturnsAnotherInstance;
+ return anotherInstance;
+ } else
+ return this;
+ }
+};
+customElements.define('returns-another-instance', ReturnsAnotherInstance);
+
+</script>
+<instantiates-itself-before-super></instantiates-itself-before-super>
+<returns-another-instance></returns-another-instance>
+<script>
+
+test(function () {
+ var instance = document.querySelector('instantiates-itself-before-super');
+
+ assert_equals(instance instanceof InstantiatesItselfBeforeSuper, 'HTML parser must insert the synchronously constructed custom element');
+ assert_equals(instance, elementCreatedBySuperCall, 'HTML parser must insert the element returned by the custom element constructor');
+ assert_not_equals(instance, anotherElementCreatedBeforeSuperCall, 'HTML parser must not insert another instance of the custom element created before super() call');
+ assert_equals(anotherElementCreatedBeforeSuperCall.parentNode, null, 'HTML parser must not insert another instance of the custom element created before super() call');
+
+}, 'HTML parser must use the returned value of the custom element constructor instead of the one created before super() call');
+
+test(function () {
+ var instance = document.querySelector('returns-another-instance');
+
+ assert_equals(instance instanceof ReturnsAnotherInstance, 'HTML parser must insert the synchronously constructed custom element');
+ assert_equals(instance, anotherInstance, 'HTML parser must insert the element returned by the custom element constructor');
+ assert_not_equals(instance, firstInstance, 'HTML parser must not insert the element created by super() call if the constructor returned another element');
+ assert_equals(firstInstance.parentNode, null, 'HTML parser must not insert the element created by super() call if the constructor returned another element');
+
+}, 'HTML parser must use the returned value of the custom element constructor instead using the one created in super() call');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserusesregistryofownerdocumentexpectedtxtfromrev207702trunkLayoutTestsfastcustomelementsparserparserusesregistryofownerdocumentexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+PASS HTML parser must not instantiate custom elements inside template elements
+PASS HTML parser must not use the registry of the owner element's document inside an iframe
+PASS HTML parser must use the registry of the content document inside an iframe
+PASS HTML parser must not instantiate a custom element defined inside an frame in frame element's owner document
+PASS HTML parser must use the registry of window.document in a document created by document.implementation.createHTMLDocument()
+PASS HTML parser must use the registry of window.document in a document created by document.implementation.createXHTMLDocument()
+PASS HTML parser must use the registry of window.document in a document created by new Document
+PASS HTML parser must use the registry of window.document in a document created by XMLHttpRequest
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserparserusesregistryofownerdocumenthtmlfromrev207702trunkLayoutTestsfastcustomelementsparserparserusesregistryofownerdocumenthtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/parser/parser-uses-registry-of-owner-document.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,126 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: HTML parser must use the owner document's custom element registry</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="HTML parser must use the owner document's custom element registry">
+<link rel="help" href="https://html.spec.whatwg.org/#create-an-element-for-the-token">
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<script>
+
+class MyCustomElement extends HTMLElement { };
+customElements.define('my-custom-element', MyCustomElement);
+
+document.write('<template><my-custom-element></my-custom-element></template>');
+
+test(function () {
+ var template = document.querySelector('template');
+ var instance = template.content.firstChild;
+
+ assert_true(instance instanceof HTMLElement,
+ 'A custom element inside a template element must be an instance of HTMLElement');
+ assert_false(instance instanceof MyCustomElement,
+ 'A custom element must not be instantiated inside a template element using the registry of the template element\'s owner document');
+ assert_equals(instance.ownerDocument, template.content.ownerDocument,
+ 'Custom elements inside a template must use the appropriate template contents owner document as the owner document');
+
+}, 'HTML parser must not instantiate custom elements inside template elements');
+
+var iframe = document.createElement('iframe');
+document.body.appendChild(iframe);
+iframe.contentDocument.body.innerHTML = '<my-custom-element></my-custom-element>';
+
+test(function () {
+ var instance = iframe.contentDocument.querySelector('my-custom-element');
+
+ assert_true(instance instanceof iframe.contentWindow.HTMLElement);
+ assert_false(instance instanceof MyCustomElement);
+
+}, 'HTML parser must not use the registry of the owner element\'s document inside an iframe');
+
+class ElementInIFrame extends iframe.contentWindow.HTMLElement { };
+iframe.contentWindow.customElements.define('element-in-iframe', ElementInIFrame);
+iframe.contentDocument.body.innerHTML = '<element-in-iframe></element-in-iframe>';
+
+test(function () {
+ var instance = iframe.contentDocument.querySelector('element-in-iframe');
+
+ assert_true(instance instanceof iframe.contentWindow.HTMLElement, 'A custom element inside an iframe must be an instance of HTMLElement');
+ assert_true(instance instanceof ElementInIFrame,
+ 'A custom element must be instantiated inside an iframe using the registry of the content document');
+ assert_equals(instance.ownerDocument, iframe.contentDocument,
+ 'The owner document of custom elements inside an iframe must be the content document of the iframe');
+
+}, 'HTML parser must use the registry of the content document inside an iframe');
+
+document.write('<element-in-iframe></element-in-iframe>');
+
+test(function () {
+ var instance = document.querySelector('element-in-iframe');
+
+ assert_true(instance instanceof HTMLElement);
+ assert_false(instance instanceof ElementInIFrame);
+
+}, 'HTML parser must not instantiate a custom element defined inside an frame in frame element\'s owner document');
+
+document.body.removeChild(iframe);
+
+test(function () {
+ var windowlessDocument = document.implementation.createHTMLDocument();
+ windowlessDocument.open();
+ windowlessDocument.write('<my-custom-element></my-custom-element>');
+ windowlessDocument.close();
+
+ var instance = windowlessDocument.querySelector('my-custom-element');
+
+ assert_true(instance instanceof HTMLElement);
+ assert_false(instance instanceof MyCustomElement);
+
+}, 'HTML parser must use the registry of window.document in a document created by document.implementation.createHTMLDocument()');
+
+test(function () {
+ var windowlessDocument = document.implementation.createDocument ('http://www.w3.org/1999/xhtml', 'html', null);
+ windowlessDocument.documentElement.innerHTML = '<my-custom-element></my-custom-element>';
+
+ var instance = windowlessDocument.querySelector('my-custom-element');
+ assert_true(instance instanceof HTMLElement);
+ assert_false(instance instanceof MyCustomElement);
+
+}, 'HTML parser must use the registry of window.document in a document created by document.implementation.createXHTMLDocument()');
+
+test(function () {
+ var windowlessDocument = new Document;
+ windowlessDocument.appendChild(windowlessDocument.createElement('html'));
+ windowlessDocument.documentElement.innerHTML = '<my-custom-element></my-custom-element>';
+
+ var instance = windowlessDocument.querySelector('my-custom-element');
+
+ assert_true(instance instanceof Element);
+ assert_false(instance instanceof MyCustomElement);
+
+}, 'HTML parser must use the registry of window.document in a document created by new Document');
+
+promise_test(function () {
+ return new Promise(function (resolve, reject) {
+ var xhr = new XMLHttpRequest();
+ xhr.open('GET', '../resources/empty-html-document.html');
+ xhr.overrideMimeType('text/xml');
+ xhr.onload = function () { resolve(xhr.responseXML); }
+ xhr.onerror = function () { reject('Failed to fetch the document'); }
+ xhr.send();
+ }).then(function (doc) {
+ doc.documentElement.innerHTML = '<my-custom-element></my-custom-element>';
+ var instance = doc.querySelector('my-custom-element');
+ assert_true(instance instanceof Element);
+ assert_false(instance instanceof MyCustomElement);
+ });
+}, 'HTML parser must use the registry of window.document in a document created by XMLHttpRequest');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsparserw3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/w3c-import.log (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/w3c-import.log         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/w3c-import.log        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,24 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-in-document-write.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-element-synchronously.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-constructs-custom-elements.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-fallsback-to-unknown-element.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-sets-attributes-and-children.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-constructed-element.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/parser-uses-registry-of-owner-document.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsDOMTokenListexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList-expected.txt (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList-expected.txt        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -6,7 +6,7 @@
</span><span class="cx"> PASS add on DOMTokenList must enqueue exactly one attributeChanged reaction when adding multiple values to an attribute
</span><span class="cx"> PASS remove on DOMTokenList must enqueue an attributeChanged reaction when removing a value from an attribute
</span><span class="cx"> PASS remove on DOMTokenList must enqueue exactly one attributeChanged reaction when removing multiple values to an attribute
</span><del>-FAIL remove on DOMTokenList must not enqueue an attributeChanged reaction when removing a non-existent value from an attribute assert_array_equals: lengths differ, expected 0 got 1
</del><ins>+PASS remove on DOMTokenList must enqueue an attributeChanged reaction even when removing a non-existent value from an attribute
</ins><span class="cx"> PASS remove on DOMTokenList must not enqueue an attributeChanged reaction when removing a value from an unobserved attribute
</span><span class="cx"> PASS toggle on DOMTokenList must enqueue an attributeChanged reaction when adding a value to an attribute
</span><span class="cx"> PASS toggle on DOMTokenList must enqueue an attributeChanged reaction when removing a value from an attribute
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsDOMTokenListhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList.html (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList.html        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/DOMTokenList.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -89,8 +89,10 @@
</span><span class="cx"> instance.setAttribute('class', 'hello world');
</span><span class="cx"> assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
</span><span class="cx"> instance.classList.remove('foo');
</span><del>- assert_array_equals(element.takeLog().types(), []);
-}, 'remove on DOMTokenList must not enqueue an attributeChanged reaction when removing a non-existent value from an attribute');
</del><ins>+ var logEntries = element.takeLog();
+ assert_array_equals(logEntries.types(), ['attributeChanged']);
+ assert_attribute_log_entry(logEntries.last(), {name: 'class', oldValue: 'hello world', newValue: 'hello world', namespace: null});
+}, 'remove on DOMTokenList must enqueue an attributeChanged reaction even when removing a non-existent value from an attribute');
</ins><span class="cx">
</span><span class="cx"> test(function () {
</span><span class="cx"> var element = define_new_custom_element(['title']);
</span></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 (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx">
</span><del>-FAIL importNode on Document must construct a new custom element when importing a custom element assert_array_equals: lengths differ, expected 1 got 0
</del><ins>+PASS importNode on Document must not construct a new custom element when importing a custom element into a window-less document
+PASS importNode on Document must construct a new custom element when importing a custom element from a template
</ins><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><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 (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Document.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -23,14 +23,20 @@
</span><span class="cx"> var newDoc = document.implementation.createHTMLDocument();
</span><span class="cx"> newDoc.importNode(instance);
</span><span class="cx">
</span><del>- var logEntries = element.takeLog();
- assert_array_equals(logEntries.types(), ['constructed']);
- assert_equals(logEntries.last().oldDocument, document);
- assert_equals(logEntries.last().newDocument, newDoc);
-}, 'importNode on Document must construct a new custom element when importing a custom element');
</del><ins>+ assert_array_equals(element.takeLog().types(), []);
+}, 'importNode on Document must not construct a new custom element when importing a custom element into a window-less document');
</ins><span class="cx">
</span><span class="cx"> test(function () {
</span><span class="cx"> var element = define_new_custom_element();
</span><ins>+ var template = document.createElement('template');
+ template.innerHTML = `<${element.name}></${element.name}>`;
+ assert_array_equals(element.takeLog().types(), []);
+ document.importNode(template.content, true);
+ assert_array_equals(element.takeLog().types(), ['constructed']);
+}, 'importNode on Document must construct a new custom element when importing a custom element from a template');
+
+test(function () {
+ var element = define_new_custom_element();
</ins><span class="cx"> var instance = document.createElement(element.name);
</span><span class="cx"> assert_array_equals(element.takeLog().types(), ['constructed']);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsreactionsRangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range-expected.txt (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range-expected.txt        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -8,6 +8,5 @@
</span><span class="cx"> PASS insertNode on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document
</span><span class="cx"> PASS surroundContents on Range must enqueue a connected reaction
</span><span class="cx"> PASS surroundContents on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document
</span><del>-FAIL createContextualFragment on Range must construct a custom element assert_equals: expected (function) function "class CustomElement extends HTMLElement {
- constru..." but got (object) object "[object Object]"
</del><ins>+FAIL createContextualFragment on Range must construct a custom element assert_array_equals: lengths differ, expected 2 got 1
</ins><span class="cx">
</span></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 (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/resources/reactions.js        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx"> var element = define_new_custom_element(['id']);
</span><span class="cx"> assert_array_equals(element.takeLog().types(), []);
</span><span class="cx"> var instance = testFunction(document, `<${element.name} id="hello" class="foo"></${element.name}>`);
</span><del>- assert_equals(Object.getPrototypeOf(instance.querySelector(element.name)), element.class);
</del><ins>+ assert_equals(Object.getPrototypeOf(instance.querySelector(element.name)), element.class.prototype);
</ins><span class="cx"> var logEntries = element.takeLog();
</span><span class="cx"> assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged']);
</span><span class="cx"> assert_attribute_log_entry(logEntries[1], {name: 'id', oldValue: null, newValue: 'hello', namespace: null});
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingNodecloneNodeexpectedtxtfromrev207702trunkLayoutTestsfastcustomelementsupgradingNodecloneNodeexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode-expected.txt (from rev 207702, trunk/LayoutTests/fast/custom-elements/upgrading/Node-cloneNode-expected.txt) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+
+PASS Node.prototype.cloneNode(false) must be able to clone a custom element
+PASS Node.prototype.cloneNode(false) must be able to clone a custom element inside an iframe
+PASS Node.prototype.cloneNode(true) must be able to clone a descendent custom element
+PASS Node.prototype.cloneNode(true) must set parentNode, previousSibling, and nextSibling before upgrading custom elements
+PASS HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself after super() call
+PASS HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself before super() call
+PASS Upgrading a custom element must throw InvalidStateError when the custom element's constructor returns another element
+PASS Inserting an element must not try to upgrade a custom element when it had already failed to upgrade once
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingNodecloneNodehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode.html (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,185 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Upgrading</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="Node.prototype.cloneNode should upgrade a custom element">
+<link rel="help" href="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>
+
+test(function () {
+ class MyCustomElement extends HTMLElement {}
+ customElements.define('my-custom-element', MyCustomElement);
+
+ var instance = document.createElement('my-custom-element');
+ assert_true(instance instanceof HTMLElement);
+ assert_true(instance instanceof MyCustomElement);
+
+ var clone = instance.cloneNode(false);
+ assert_not_equals(instance, clone);
+ assert_true(clone instanceof HTMLElement,
+ 'A cloned custom element must be an instance of HTMLElement');
+ assert_true(clone instanceof MyCustomElement,
+ 'A cloned custom element must be an instance of the custom element');
+}, 'Node.prototype.cloneNode(false) must be able to clone a custom element');
+
+test_with_window(function (contentWindow) {
+ var contentDocument = contentWindow.document;
+ class MyCustomElement extends contentWindow.HTMLElement {}
+ contentWindow.customElements.define('my-custom-element', MyCustomElement);
+
+ var instance = contentDocument.createElement('my-custom-element');
+ assert_true(instance instanceof contentWindow.HTMLElement);
+ assert_true(instance instanceof MyCustomElement);
+
+ var clone = instance.cloneNode(false);
+ assert_not_equals(instance, clone);
+ assert_true(clone instanceof contentWindow.HTMLElement,
+ 'A cloned custom element must be an instance of HTMLElement');
+ assert_true(clone instanceof MyCustomElement,
+ 'A cloned custom element must be an instance of the custom element');
+}, 'Node.prototype.cloneNode(false) must be able to clone a custom element inside an iframe');
+
+test_with_window(function (contentWindow) {
+ var contentDocument = contentWindow.document;
+ class MyCustomElement extends contentWindow.HTMLElement { }
+ contentWindow.customElements.define('my-custom-element', MyCustomElement);
+
+ var instance = contentDocument.createElement('my-custom-element');
+ var container = contentDocument.createElement('div');
+ container.appendChild(instance);
+
+ var containerClone = container.cloneNode(true);
+ assert_true(containerClone instanceof contentWindow.HTMLDivElement);
+
+ var clone = containerClone.firstChild;
+ assert_not_equals(instance, clone);
+ assert_true(clone instanceof contentWindow.HTMLElement,
+ 'A cloned custom element must be an instance of HTMLElement');
+ assert_true(clone instanceof MyCustomElement,
+ 'A cloned custom element must be an instance of the custom element');
+}, 'Node.prototype.cloneNode(true) must be able to clone a descendent custom element');
+
+test_with_window(function (contentWindow) {
+ var parentNodeInConstructor;
+ var previousSiblingInConstructor;
+ var nextSiblingInConstructor;
+ class MyCustomElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ parentNodeInConstructor = this.parentNode;
+ previousSiblingInConstructor = this.previousSibling;
+ nextSiblingInConstructor = this.nextSibling;
+ }
+ }
+ contentWindow.customElements.define('my-custom-element', MyCustomElement);
+
+ var contentDocument = contentWindow.document;
+ var instance = contentDocument.createElement('my-custom-element');
+ var siblingBeforeInstance = contentDocument.createElement('b');
+ var siblingAfterInstance = contentDocument.createElement('a');
+ var container = contentDocument.createElement('div');
+ container.appendChild(siblingBeforeInstance);
+ container.appendChild(instance);
+ container.appendChild(siblingAfterInstance);
+
+ var containerClone = container.cloneNode(true);
+
+ assert_equals(parentNodeInConstructor, containerClone,
+ 'An upgraded element must have its parentNode set before the custom element constructor is called');
+ assert_equals(previousSiblingInConstructor, containerClone.firstChild,
+ 'An upgraded element must have its previousSibling set before the custom element constructor is called');
+ assert_equals(nextSiblingInConstructor, containerClone.lastChild,
+ 'An upgraded element must have its nextSibling set before the custom element constructor is called');
+}, 'Node.prototype.cloneNode(true) must set parentNode, previousSibling, and nextSibling before upgrading custom elements');
+
+test_with_window(function (contentWindow) {
+ class MyCustomElement extends contentWindow.HTMLElement {
+ constructor(doNotCreateItself) {
+ super();
+ if (!doNotCreateItself)
+ new MyCustomElement(true);
+ }
+ }
+ contentWindow.customElements.define('my-custom-element', MyCustomElement);
+
+ var instance = new MyCustomElement(false);
+ var uncaughtError;
+ contentWindow.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
+ instance.cloneNode(false);
+ assert_equals(uncaughtError.name, 'InvalidStateError');
+}, 'HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed'
+ + ' due to a custom element constructor constructing itself after super() call');
+
+test_with_window(function (contentWindow) {
+ class MyCustomElement extends contentWindow.HTMLElement {
+ constructor(doNotCreateItself) {
+ if (!doNotCreateItself)
+ new MyCustomElement(true);
+ super();
+ }
+ }
+ contentWindow.customElements.define('my-custom-element', MyCustomElement);
+
+ var instance = new MyCustomElement(false);
+ var uncaughtError;
+ contentWindow.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
+ instance.cloneNode(false);
+ assert_equals(uncaughtError.name, 'InvalidStateError');
+}, 'HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed'
+ + ' due to a custom element constructor constructing itself before super() call');
+
+test_with_window(function (contentWindow) {
+ var contentDocument = contentWindow.document;
+ var returnSpan = false;
+ class MyCustomElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ if (returnSpan)
+ return contentDocument.createElement('span');
+ }
+ }
+ contentWindow.customElements.define('my-custom-element', MyCustomElement);
+
+ var instance = new MyCustomElement(false);
+ returnSpan = true;
+ var uncaughtError;
+ contentWindow.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
+ instance.cloneNode(false);
+ assert_equals(uncaughtError.name, 'InvalidStateError');
+}, 'Upgrading a custom element must throw InvalidStateError when the custom element\'s constructor returns another element');
+
+test_with_window(function (contentWindow) {
+ var contentDocument = contentWindow.document;
+ var instance = contentDocument.createElement('my-custom-element');
+ contentDocument.body.appendChild(instance);
+
+ var calls = [];
+ class MyCustomElement extends contentWindow.HTMLElement {
+ constructor() {
+ super();
+ calls.push(this);
+ throw 'bad';
+ }
+ }
+
+ var uncaughtError;
+ contentWindow.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
+ contentWindow.customElements.define('my-custom-element', MyCustomElement);
+ assert_equals(uncaughtError, 'bad');
+
+ assert_array_equals(calls, [instance]);
+ contentDocument.body.removeChild(instance);
+ contentDocument.body.appendChild(instance);
+ assert_array_equals(calls, [instance]);
+}, 'Inserting an element must not try to upgrade a custom element when it had already failed to upgrade once');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingupgradingparsercreatedelementexpectedtxtfromrev207702trunkLayoutTestsfastcustomelementsupgradingupgradingparsercreatedelementexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element-expected.txt (from rev 207702, trunk/LayoutTests/fast/custom-elements/upgrading/upgrading-parser-created-element-expected.txt) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+
+PASS Element.prototype.createElement must add an unresolved custom element to the upgrade candidates map
+PASS HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself after super() call
+PASS HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed due to a custom element constructor constructing itself before super() call
+PASS Upgrading a custom element must throw an InvalidStateError when the returned element is not SameValue as the upgraded element
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingupgradingparsercreatedelementhtmlfromrev207702trunkLayoutTestsfastcustomelementsupgradingupgradingparsercreatedelementhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/upgrading/upgrading-parser-created-element.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,97 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Upgrading unresolved elements</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="HTML parser must add an unresolved custom element to the upgrade candidates map">
+<link rel="help" href="https://html.spec.whatwg.org/#upgrades">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<my-custom-element></my-custom-element>
+<instantiates-itself-after-super></instantiates-itself-after-super>
+<instantiates-itself-before-super></instantiates-itself-before-super>
+<my-other-element id="instance"></my-other-element>
+<my-other-element id="otherInstance"></my-other-element>
+<script>
+
+setup({allow_uncaught_exception:true});
+
+test(function () {
+ class MyCustomElement extends HTMLElement { }
+
+ var instance = document.querySelector('my-custom-element');
+ assert_true(instance instanceof HTMLElement);
+ assert_false(instance instanceof HTMLUnknownElement,
+ 'an unresolved custom element should not be an instance of HTMLUnknownElement');
+ assert_false(instance instanceof MyCustomElement);
+
+ customElements.define('my-custom-element', MyCustomElement);
+
+ assert_true(instance instanceof HTMLElement);
+ assert_true(instance instanceof MyCustomElement,
+ 'Calling customElements.define must upgrade existing custom elements');
+
+}, 'Element.prototype.createElement must add an unresolved custom element to the upgrade candidates map');
+
+test(function () {
+ class InstantiatesItselfAfterSuper extends HTMLElement {
+ constructor(doNotCreateItself) {
+ super();
+ if (!doNotCreateItself)
+ new InstantiatesItselfAfterSuper(true);
+ }
+ }
+
+ var uncaughtError;
+ window.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
+ customElements.define('instantiates-itself-after-super', InstantiatesItselfAfterSuper);
+ assert_equals(uncaughtError.name, 'InvalidStateError');
+}, 'HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed'
+ + ' due to a custom element constructor constructing itself after super() call');
+
+test(function () {
+ class InstantiatesItselfBeforeSuper extends HTMLElement {
+ constructor(doNotCreateItself) {
+ if (!doNotCreateItself)
+ new InstantiatesItselfBeforeSuper(true);
+ super();
+ }
+ }
+
+ var uncaughtError;
+ window.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
+ customElements.define('instantiates-itself-before-super', InstantiatesItselfBeforeSuper);
+ assert_equals(uncaughtError.name, 'InvalidStateError');
+}, 'HTMLElement constructor must throw an InvalidStateError when the top of the construction stack is marked AlreadyConstructed'
+ + ' due to a custom element constructor constructing itself before super() call');
+
+test(function () {
+ class MyOtherElement extends HTMLElement {
+ constructor() {
+ super();
+ if (this == instance)
+ return otherInstance;
+ }
+ }
+ var instance = document.getElementById('instance');
+ var otherInstance = document.getElementById('otherInstance');
+
+ assert_false(instance instanceof MyOtherElement);
+ assert_false(otherInstance instanceof MyOtherElement);
+
+ var uncaughtError;
+ window.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
+ customElements.define('my-other-element', MyOtherElement);
+ assert_equals(uncaughtError.name, 'InvalidStateError');
+
+ assert_true(document.createElement('my-other-element') instanceof MyOtherElement,
+ 'Upgrading of custom elements must happen after the definition was added to the registry.');
+
+}, 'Upgrading a custom element must throw an InvalidStateError when the returned element is not SameValue as the upgraded element');
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingw3cimportlog"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+The tests in this directory were imported from the W3C repository.
+Do NOT modify these tests directly in WebKit.
+Instead, create a pull request on the W3C CSS or WPT github:
+        https://github.com/w3c/csswg-test
+        https://github.com/w3c/web-platform-tests
+
+Then run the Tools/Scripts/import-w3c-tests in WebKit to reimport
+
+Do NOT modify or remove this file.
+
+------------------------------------------------------------------------
+Properties requiring vendor prefixes:
+None
+Property values requiring vendor prefixes:
+None
+------------------------------------------------------------------------
+List of files:
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode.html
+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/upgrading-parser-created-element.html
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradingexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading-expected.txt        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+
+PASS Creating an element in the document of the template elements must not enqueue a custom element upgrade reaction because the document does not have a browsing context
+PASS Creating an element in the document of the template elements and inserting into the document must not enqueue a custom element upgrade reaction
+PASS Creating an element in the document of the template elements and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
+PASS Creating an element in a new document must not enqueue a custom element upgrade reaction because the document does not have a browsing context
+PASS Creating an element in a new document and inserting into the document must not enqueue a custom element upgrade reaction
+PASS Creating an element in a new document and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
+PASS Creating an element in a cloned document must not enqueue a custom element upgrade reaction because the document does not have a browsing context
+PASS Creating an element in a cloned document and inserting into the document must not enqueue a custom element upgrade reaction
+PASS Creating an element in a cloned document and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
+PASS Creating an element in a document created by createHTMLDocument must not enqueue a custom element upgrade reaction because the document does not have a browsing context
+PASS Creating an element in a document created by createHTMLDocument and inserting into the document must not enqueue a custom element upgrade reaction
+PASS Creating an element in a document created by createHTMLDocument and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
+PASS Creating an element in an HTML document created by createDocument must not enqueue a custom element upgrade reaction because the document does not have a browsing context
+PASS Creating an element in an HTML document created by createDocument and inserting into the document must not enqueue a custom element upgrade reaction
+PASS Creating an element in an HTML document created by createDocument and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
+PASS Creating an element in an HTML document fetched by XHR must not enqueue a custom element upgrade reaction because the document does not have a browsing context
+PASS Creating an element in an HTML document fetched by XHR and inserting into the document must not enqueue a custom element upgrade reaction
+PASS Creating an element in an HTML document fetched by XHR and adopting back to a document with browsing context must enqueue a custom element upgrade reaction
+PASS Creating an element in the document of an iframe must not enqueue a custom element upgrade reaction if there is no matching definition
+PASS Creating an element in the document of an iframe must enqueue a custom element upgrade reaction if there is a matching definition
+PASS "define" in the document of an iframe must not enqueue a custom element upgrade reaction on a disconnected unresolved custom element
+PASS Inserting an unresolved custom element into the document of an iframe must enqueue a custom element upgrade reaction
+PASS "define" in the document of an iframe must enqueue a custom element upgrade reaction on a connected unresolved custom element
+PASS Adopting (and leaving disconnceted) an unresolved custom element into the document of an iframe must not enqueue a custom element upgrade reaction
+PASS Adopting and inserting an unresolved custom element into the document of an iframe must enqueue a custom element upgrade reaction
+
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsupgradinghtmlfromrev207702trunkLayoutTestsfastcustomelementsenqueuecustomelementupgradereactionhtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading.html (from rev 207702, trunk/LayoutTests/fast/custom-elements/enqueue-custom-element-upgrade-reaction.html) (0 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading.html         (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading.html        2016-10-22 02:47:18 UTC (rev 207703)
</span><span class="lines">@@ -0,0 +1,190 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<title>Custom Elements: Enqueue a custom element upgrade reaction</title>
+<meta name="author" title="Ryosuke Niwa" href="mailto:rniwa@webkit.org">
+<meta name="assert" content="Enqueue a custom element upgrade reaction must upgrade a custom element">
+<link rel="help" href="https://dom.spec.whatwg.org/#concept-create-element">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#concept-try-upgrade">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#enqueue-a-custom-element-upgrade-reaction">
+<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>
+
+class PredefinedCustomElement extends HTMLElement {}
+customElements.define('predefined-custom-element', PredefinedCustomElement);
+
+var customElementNumber = 1;
+function generateNextCustomElementName() { return 'custom-' + customElementNumber++; }
+
+// Tests for documents without a browsing context.
+document_types().filter(function (entry) { return !entry.isOwner && !entry.hasBrowsingContext; }).forEach(function (entry) {
+ var documentName = entry.name;
+ var getDocument = entry.create;
+
+ promise_test(function () {
+ return getDocument().then(function (doc) {
+ assert_false(doc.createElement('predefined-custom-element') instanceof PredefinedCustomElement);
+ });
+ }, 'Creating an element in ' + documentName + ' must not enqueue a custom element upgrade reaction'
+ + ' because the document does not have a browsing context');
+
+ promise_test(function () {
+ var name = generateNextCustomElementName();
+ var unresolvedElement = document.createElement(name);
+
+ assert_equals(unresolvedElement.__proto__, HTMLElement.prototype,
+ '[[Prototype]] internal slot of the unresolved custom element must be the HTMLElement prototype');
+
+ return getDocument().then(function (doc) {
+ var unresolvedElementInDoc = doc.createElement(name);
+ var prototype = (unresolvedElementInDoc.namespaceURI == 'http://www.w3.org/1999/xhtml' ? HTMLElement : Element).prototype;
+
+ assert_equals(unresolvedElementInDoc.__proto__, prototype,
+ '[[Prototype]] internal slot of the unresolved custom element must be the ' + prototype.toString() + ' prototype');
+ var someCustomElement = class extends HTMLElement {};
+ customElements.define(name, someCustomElement);
+ assert_equals(unresolvedElementInDoc.__proto__, prototype, '"define" must not upgrade a disconnected unresolved custom elements');
+ doc.documentElement.appendChild(unresolvedElementInDoc);
+ assert_equals(unresolvedElementInDoc.__proto__, prototype,
+ 'Inserting an element into a document without a browsing context must not enqueue a custom element upgrade reaction');
+ });
+ }, 'Creating an element in ' + documentName + ' and inserting into the document must not enqueue a custom element upgrade reaction');
+
+ promise_test(function () {
+ var name = generateNextCustomElementName();
+ var unresolvedElement = document.createElement(name);
+
+ assert_equals(unresolvedElement.__proto__, HTMLElement.prototype,
+ '[[Prototype]] internal slot of the unresolved custom element must be the HTMLElement prototype');
+
+ return getDocument().then(function (doc) {
+ var unresolvedElementInDoc = doc.createElement(name);
+ var prototype = (unresolvedElementInDoc.namespaceURI == 'http://www.w3.org/1999/xhtml' ? HTMLElement : Element).prototype;
+
+ assert_equals(unresolvedElementInDoc.__proto__, prototype,
+ '[[Prototype]] internal slot of the unresolved custom element must be the ' + prototype.toString() + ' prototype');
+ var someCustomElement = class extends HTMLElement {};
+ customElements.define(name, someCustomElement);
+ assert_equals(unresolvedElementInDoc.__proto__, prototype, '"define" must not upgrade a disconnected unresolved custom elements');
+ document.body.appendChild(unresolvedElementInDoc);
+
+ if (unresolvedElementInDoc.namespaceURI == 'http://www.w3.org/1999/xhtml') {
+ assert_equals(unresolvedElementInDoc.__proto__, someCustomElement.prototype,
+ 'Inserting an element into a document with a browsing context must enqueue a custom element upgrade reaction');
+ } else {
+ assert_equals(unresolvedElementInDoc.__proto__, prototype,
+ 'Looking up a custom element definition must return null if the element is not in the HTML namespace');
+ }
+ });
+ }, 'Creating an element in ' + documentName + ' and adopting back to a document with browsing context must enqueue a custom element upgrade reaction');
+
+});
+
+// Tests for documents with a browsing context.
+document_types().filter(function (entry) { return !entry.isOwner && entry.hasBrowsingContext; }).forEach(function (entry) {
+ var documentName = entry.name;
+ var getDocument = entry.create;
+
+ promise_test(function () {
+ return getDocument().then(function (doc) {
+ assert_false(doc.createElement('predefined-custom-element') instanceof PredefinedCustomElement);
+ });
+ }, 'Creating an element in ' + documentName + ' must not enqueue a custom element upgrade reaction if there is no matching definition');
+
+ promise_test(function () {
+ return getDocument().then(function (doc) {
+ var docWindow = doc.defaultView;
+ class DistinctPredefinedCustomElement extends docWindow.HTMLElement { };
+ docWindow.customElements.define('predefined-custom-element', DistinctPredefinedCustomElement);
+ assert_true(doc.createElement('predefined-custom-element') instanceof DistinctPredefinedCustomElement);
+ });
+ }, 'Creating an element in ' + documentName + ' must enqueue a custom element upgrade reaction if there is a matching definition');
+
+ promise_test(function () {
+ var unresolvedElement = document.createElement('unresolved-element');
+ return getDocument().then(function (doc) {
+ var docWindow = doc.defaultView;
+ class UnresolvedElement extends docWindow.HTMLElement { };
+ var unresolvedElementInDoc = doc.createElement('unresolved-element');
+
+ assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
+ assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype);
+
+ docWindow.customElements.define('unresolved-element', UnresolvedElement);
+
+ assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
+ assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype);
+
+ });
+ }, '"define" in ' + documentName + ' must not enqueue a custom element upgrade reaction on a disconnected unresolved custom element');
+
+ promise_test(function () {
+ var unresolvedElement = document.createElement('unresolved-element');
+ return getDocument().then(function (doc) {
+ var docWindow = doc.defaultView;
+ class UnresolvedElement extends docWindow.HTMLElement { };
+ var unresolvedElementInDoc = doc.createElement('unresolved-element');
+
+ assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
+ assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype);
+
+ docWindow.customElements.define('unresolved-element', UnresolvedElement);
+ doc.documentElement.appendChild(unresolvedElementInDoc);
+
+ assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
+ assert_equals(unresolvedElementInDoc.__proto__, UnresolvedElement.prototype);
+ });
+ }, 'Inserting an unresolved custom element into ' + documentName + ' must enqueue a custom element upgrade reaction');
+
+ promise_test(function () {
+ var unresolvedElement = document.createElement('unresolved-element');
+ return getDocument().then(function (doc) {
+ var docWindow = doc.defaultView;
+ class UnresolvedElement extends docWindow.HTMLElement { };
+ var unresolvedElementInDoc = doc.createElement('unresolved-element');
+ doc.documentElement.appendChild(unresolvedElementInDoc);
+
+ assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
+ assert_equals(unresolvedElementInDoc.__proto__, docWindow.HTMLElement.prototype);
+
+ docWindow.customElements.define('unresolved-element', UnresolvedElement);
+
+ assert_equals(unresolvedElement.__proto__, HTMLElement.prototype);
+ assert_equals(unresolvedElementInDoc.__proto__, UnresolvedElement.prototype);
+ });
+ }, '"define" in ' + documentName + ' must enqueue a custom element upgrade reaction on a connected unresolved custom element');
+
+ promise_test(function () {
+ var unresolvedElement = document.createElement('unresolved-element');
+ return getDocument().then(function (doc) {
+ var docWindow = doc.defaultView;
+ class UnresolvedElement extends docWindow.HTMLElement { };
+ assert_false(unresolvedElement instanceof UnresolvedElement);
+ docWindow.customElements.define('unresolved-element', UnresolvedElement);
+ doc.adoptNode(unresolvedElement);
+ assert_false(unresolvedElement instanceof UnresolvedElement);
+ });
+ }, 'Adopting (and leaving disconnceted) an unresolved custom element into ' + documentName + ' must not enqueue a custom element upgrade reaction');
+
+ promise_test(function () {
+ var unresolvedElement = document.createElement('unresolved-element');
+ return getDocument().then(function (doc) {
+ var docWindow = doc.defaultView;
+ class UnresolvedElement extends docWindow.HTMLElement { };
+ assert_false(unresolvedElement instanceof UnresolvedElement);
+ docWindow.customElements.define('unresolved-element', UnresolvedElement);
+ doc.documentElement.appendChild(unresolvedElement);
+ assert_true(unresolvedElement instanceof UnresolvedElement);
+ });
+ }, 'Adopting and inserting an unresolved custom element into ' + documentName + ' must enqueue a custom element upgrade reaction');
+
+});
+
+</script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscustomelementsw3cimportlog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/w3c-import.log (207702 => 207703)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/w3c-import.log        2016-10-22 02:17:42 UTC (rev 207702)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/w3c-import.log        2016-10-22 02:47:18 UTC (rev 207703)
</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/CustomElementRegistry.html
</span><ins>+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement.html
</ins><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/HTMLElement-constructor.html
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/OWNERS
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/adopted-callback.html
</span><span class="lines">@@ -23,3 +24,4 @@
</span><span class="cx"> /LayoutTests/imported/w3c/web-platform-tests/custom-elements/connected-callbacks.html
</span><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><ins>+/LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading.html
</ins></span></pre>
</div>
</div>
</body>
</html>