Skip to content

Commit

Permalink
Resync web-platform-tests/custom-elements
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=250362

Reviewed by Tim Nguyen.

Resync web platform tests for custom elements as of ea3e60a.

* LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement-customized-builtins-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement-customized-builtins.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElement.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElementNS-customized-builtins-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElementNS-customized-builtins.html: Copied from LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElementNS.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElementNS-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/Document-createElementNS.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-registry/define-customized-builtins-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-registry/define-customized-builtins.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-registry/define-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-registry/define.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/custom-element-registry/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-customized-builtins-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-customized-builtins.html: Copied from LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/newtarget.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/htmlconstructor/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/serializing-html-fragments-customized-builtins-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/serializing-html-fragments-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/serializing-html-fragments-customized-builtins.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/serializing-html-fragments.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/parser/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/pseudo-class-defined-customized-builtins-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/pseudo-class-defined-customized-builtins.html: Copied from LayoutTests/imported/w3c/web-platform-tests/custom-elements/pseudo-class-defined.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/pseudo-class-defined-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/pseudo-class-defined.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLModElement-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptGroupElement-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLAreaElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAreaElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLAreaElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLAreaElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLBaseElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLBaseElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLBaseElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLBaseElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLButtonElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLButtonElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLButtonElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLButtonElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLCanvasElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLCanvasElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLCanvasElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLCanvasElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLDataElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLDataElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLDataElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLDataElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLDetailsElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLDetailsElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLDetailsElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLDetailsElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLEmbedElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLEmbedElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLEmbedElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLEmbedElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLFieldSetElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLFieldSetElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLFieldSetElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLFieldSetElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLImageElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLImageElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLImageElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLImageElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLInputElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLInputElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLInputElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLInputElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLLIElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLLIElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLLIElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLLIElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLLabelElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLLabelElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLLabelElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLLabelElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLMapElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLMapElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLMapElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLMapElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLMediaElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLMediaElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLMediaElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLMediaElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLMetaElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLMetaElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLMetaElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLMetaElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLMeterElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLMeterElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLMeterElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLMeterElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLModElement-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLModElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLModElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLOListElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOListElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLOListElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOListElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLOptGroupElement-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLOptGroupElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLOptGroupElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLParamElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLParamElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLParamElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLParamElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLProgressElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLProgressElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLProgressElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLProgressElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLQuoteElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLQuoteElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLQuoteElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLQuoteElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLSlotElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSlotElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLSlotElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSlotElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLSourceElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSourceElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLSourceElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLSourceElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLStyleElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLStyleElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLStyleElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLStyleElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLTableCellElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableCellElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLTableCellElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableCellElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLTableColElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableColElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLTableColElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTableColElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLTimeElement-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTimeElement-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/HTMLTimeElement.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/HTMLTimeElement.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/customized-builtins/w3c-import.log: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Document-importNode-customized-builtins-expected.txt: Copied from LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Document-importNode-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Document-importNode-customized-builtins.html: Copied from LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Document-importNode.html.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Document-importNode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Document-importNode.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode-customized-builtins-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode-customized-builtins.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/Node-cloneNode.html:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/upgrading/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/custom-elements/w3c-import.log:

Canonical link: https://commits.webkit.org/258711@main
  • Loading branch information
rniwa committed Jan 10, 2023
1 parent b81575a commit f0f68a8
Show file tree
Hide file tree
Showing 95 changed files with 723 additions and 486 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

PASS document.createElement must create an instance of autonomous custom elements when it has is attribute
FAIL document.createElement()'s second argument is to be ignored when it's a string assert_true: expected true got false
FAIL document.createElement must report an exception thrown by a custom built-in element constructor assert_throws_exactly: function "function () { new ThrowCustomBuiltinElement; }" threw object "TypeError: Illegal constructor" but we expected it to throw object "[object Object]"
FAIL document.createElement with unknown "is" value should create "undefined" state element assert_true: Undefined element is upgraded on connecting to a document expected true got false

Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<!DOCTYPE html>
<html>
<head>
<title>Custom Elements: document.createElement should create a customized builtin element with synchronous custom elements flag set</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/custom-elements-helpers.js"></script>
</head>
<body>
<div id="log"></div>
<script>
setup({allow_uncaught_exception:true});

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;
}

test(function () {
class AutonomousCustomElement extends HTMLElement {};
class IsCustomElement extends HTMLElement {};

customElements.define('autonomous-custom-element', AutonomousCustomElement);
customElements.define('is-custom-element', IsCustomElement);

var instance = document.createElement('autonomous-custom-element', { is: 'is-custom-element'});

assert_true(instance instanceof AutonomousCustomElement);
assert_equals(instance.localName, 'autonomous-custom-element');
assert_equals(instance.namespaceURI, 'http://www.w3.org/1999/xhtml', 'A custom element HTML must use HTML namespace');

var instance2 = document.createElement('undefined-element', { is: 'is-custom-element'});
assert_false(instance2.matches(':defined'));
class DefinedLater extends HTMLElement {}
customElements.define('undefined-element', DefinedLater);
document.body.appendChild(instance2);
assert_true(instance2 instanceof DefinedLater);
}, 'document.createElement must create an instance of autonomous custom elements when it has is attribute');

test(() => {
class SuperP extends HTMLParagraphElement {}
customElements.define("super-p", SuperP, { extends: "p" });

const superP = document.createElement("p", { is: "super-p" });
assert_true(superP instanceof HTMLParagraphElement);
assert_true(superP instanceof SuperP);
assert_equals(superP.localName, "p");

const notSuperP = document.createElement("p", "super-p");
assert_true(notSuperP instanceof HTMLParagraphElement);
assert_false(notSuperP instanceof SuperP);
assert_equals(notSuperP.localName, "p");
}, "document.createElement()'s second argument is to be ignored when it's a string");

test(function () {
var exceptionToThrow = {name: 'exception thrown by a custom constructor'};
class ThrowCustomBuiltinElement extends HTMLDivElement {
constructor()
{
super();
if (exceptionToThrow)
throw exceptionToThrow;
}
};
customElements.define('throw-custom-builtin-element', ThrowCustomBuiltinElement, { extends: 'div' });

assert_throws_exactly(exceptionToThrow, function () { new ThrowCustomBuiltinElement; });
var instance;
assert_reports(exceptionToThrow, function () { instance = document.createElement('div', { is: 'throw-custom-builtin-element' }); });
assert_equals(instance.localName, 'div');
assert_true(instance instanceof HTMLDivElement);

exceptionToThrow = false;
var instance = document.createElement('div', { is: 'throw-custom-builtin-element' });
assert_true(instance instanceof ThrowCustomBuiltinElement);
assert_equals(instance.localName, 'div');

}, 'document.createElement must report an exception thrown by a custom built-in element constructor');

test(() => {
class MyElement extends HTMLDivElement {}

// createElement with unknown 'is' should not throw.
// https://github.com/w3c/webcomponents/issues/608
let div = document.createElement('div', { is: 'my-div' });
assert_false(div instanceof MyElement);
assert_false(div.hasAttribute('is'));

customElements.define('my-div', MyElement, { extends: 'div' });
document.body.appendChild(div);
assert_true(div instanceof MyElement, 'Undefined element is upgraded on connecting to a document');
}, 'document.createElement with unknown "is" value should create "undefined" state element');

</script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

PASS document.createElement must create an instance of custom elements
PASS document.createElement must create an instance of autonomous custom elements when it has is attribute
FAIL document.createElement()'s second argument is to be ignored when it's a string assert_true: expected true got false
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
Expand Down Expand Up @@ -36,7 +34,5 @@ PASS document.createElement must report a NotSupportedError when the element is
PASS document.createElement must not report a NotSupportedError when the element is adopted back from a an 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
FAIL document.createElement must report an exception thrown by a custom built-in element constructor assert_throws_exactly: function "function () { new ThrowCustomBuiltinElement; }" threw object "TypeError: Illegal constructor" but we expected it to throw object "[object Object]"
FAIL document.createElement with unknown "is" value should create "undefined" state element assert_true: Undefined element is upgraded on connecting to a document expected true got false
PASS document.createElement with undefined options value should be upgraded.

Original file line number Diff line number Diff line change
Expand Up @@ -29,42 +29,6 @@

}, 'document.createElement must create an instance of custom elements');

test(function () {
class AutonomousCustomElement extends HTMLElement {};
class IsCustomElement extends HTMLElement {};

customElements.define('autonomous-custom-element', AutonomousCustomElement);
customElements.define('is-custom-element', IsCustomElement);

var instance = document.createElement('autonomous-custom-element', { is: 'is-custom-element'});

assert_true(instance instanceof AutonomousCustomElement);
assert_equals(instance.localName, 'autonomous-custom-element');
assert_equals(instance.namespaceURI, 'http://www.w3.org/1999/xhtml', 'A custom element HTML must use HTML namespace');

var instance2 = document.createElement('undefined-element', { is: 'is-custom-element'});
assert_false(instance2.matches(':defined'));
class DefinedLater extends HTMLElement {}
customElements.define('undefined-element', DefinedLater);
document.body.appendChild(instance2);
assert_true(instance2 instanceof DefinedLater);
}, 'document.createElement must create an instance of autonomous custom elements when it has is attribute');

test(() => {
class SuperP extends HTMLParagraphElement {}
customElements.define("super-p", SuperP, { extends: "p" });

const superP = document.createElement("p", { is: "super-p" });
assert_true(superP instanceof HTMLParagraphElement);
assert_true(superP instanceof SuperP);
assert_equals(superP.localName, "p");

const notSuperP = document.createElement("p", "super-p");
assert_true(notSuperP instanceof HTMLParagraphElement);
assert_false(notSuperP instanceof SuperP);
assert_equals(notSuperP.localName, "p");
}, "document.createElement()'s second argument is to be ignored when it's a string");

function assert_reports(expected, testFunction, message) {
var uncaughtError = null;
window.onerror = function (message, url, lineNumber, columnNumber, error) { uncaughtError = error; return true; }
Expand Down Expand Up @@ -363,45 +327,6 @@

}, 'document.createElement must report an exception thrown by a custom element constructor');

test(function () {
var exceptionToThrow = {name: 'exception thrown by a custom constructor'};
class ThrowCustomBuiltinElement extends HTMLDivElement {
constructor()
{
super();
if (exceptionToThrow)
throw exceptionToThrow;
}
};
customElements.define('throw-custom-builtin-element', ThrowCustomBuiltinElement, { extends: 'div' });

assert_throws_exactly(exceptionToThrow, function () { new ThrowCustomBuiltinElement; });
var instance;
assert_reports(exceptionToThrow, function () { instance = document.createElement('div', { is: 'throw-custom-builtin-element' }); });
assert_equals(instance.localName, 'div');
assert_true(instance instanceof HTMLDivElement);

exceptionToThrow = false;
var instance = document.createElement('div', { is: 'throw-custom-builtin-element' });
assert_true(instance instanceof ThrowCustomBuiltinElement);
assert_equals(instance.localName, 'div');

}, 'document.createElement must report an exception thrown by a custom built-in element constructor');

test(() => {
class MyElement extends HTMLDivElement {}

// createElement with unknown 'is' should not throw.
// https://github.com/w3c/webcomponents/issues/608
let div = document.createElement('div', { is: 'my-div' });
assert_false(div instanceof MyElement);
assert_false(div.hasAttribute('is'));

customElements.define('my-div', MyElement, { extends: 'div' });
document.body.appendChild(div);
assert_true(div instanceof MyElement, 'Undefined element is upgraded on connecting to a document');
}, 'document.createElement with unknown "is" value should create "undefined" state element');

test(() => {
class MyElement extends HTMLElement {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

FAIL builtin: document.createElementNS should create custom elements with prefixes. assert_true: expected true got false
PASS builtin: document.createElementNS should check namespaces.
FAIL document.createElementNS()'s third argument is to be ignored when it's a string assert_true: expected true got false

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<title>Custom Elements: document.createElementNS should support custom elements</title>
<link rel="help" content="https://dom.spec.whatwg.org/#concept-create-element">
<link rel="help" content="https://dom.spec.whatwg.org/#internal-createelementns-steps">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
test(() => {
class MyBuiltinElement extends HTMLElement {};

customElements.define('my-builtin', MyBuiltinElement, { extends: 'address' });
let element = document.createElementNS('http://www.w3.org/1999/xhtml', 'p:address', { is: 'my-builtin'});
assert_true(element instanceof MyBuiltinElement);
assert_equals(element.prefix, 'p');
assert_false(element.hasAttribute('is'));
}, 'builtin: document.createElementNS should create custom elements with prefixes.');

test(() => {
class MyBuiltinElement2 extends HTMLElement {};

customElements.define('my-builtin2', MyBuiltinElement2, { extends: 'address'});
let element = document.createElementNS('urn:example', 'address', { is: 'my-builtin2' });
assert_false(element instanceof MyBuiltinElement2);
assert_false(element.hasAttribute('is'));
}, 'builtin: document.createElementNS should check namespaces.');

test(() => {
class SuperP extends HTMLParagraphElement {}
customElements.define("super-p", SuperP, { extends: "p" });

const superP = document.createElementNS("http://www.w3.org/1999/xhtml", "p", { is: "super-p" });
assert_true(superP instanceof HTMLParagraphElement);
assert_true(superP instanceof SuperP);
assert_equals(superP.localName, "p");

const notSuperP = document.createElementNS("http://www.w3.org/1999/xhtml", "p", "super-p");
assert_true(notSuperP instanceof HTMLParagraphElement);
assert_false(notSuperP instanceof SuperP);
assert_equals(notSuperP.localName, "p");
}, "document.createElementNS()'s third argument is to be ignored when it's a string");
</script>
</body>
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@ PASS autonomous: document.createElementNS should create custom elements with pre
PASS autonomous: document.createElementNS should check namespaces.
PASS autonomous: document.createElementNS should not create HTMLUnknownElement for a valid custom element name
PASS autonomous: document.createElementNS with undefined options value should be upgraded.
FAIL builtin: document.createElementNS should create custom elements with prefixes. assert_true: expected true got false
PASS builtin: document.createElementNS should check namespaces.
FAIL document.createElementNS()'s third argument is to be ignored when it's a string assert_true: expected true got false

Original file line number Diff line number Diff line change
Expand Up @@ -39,38 +39,5 @@
assert_true(instance instanceof MyElement3);
}, 'autonomous: document.createElementNS with undefined options value should be upgraded.');

test(() => {
class MyBuiltinElement extends HTMLElement {};

customElements.define('my-builtin', MyBuiltinElement, { extends: 'address' });
let element = document.createElementNS('http://www.w3.org/1999/xhtml', 'p:address', { is: 'my-builtin'});
assert_true(element instanceof MyBuiltinElement);
assert_equals(element.prefix, 'p');
assert_false(element.hasAttribute('is'));
}, 'builtin: document.createElementNS should create custom elements with prefixes.');

test(() => {
class MyBuiltinElement2 extends HTMLElement {};

customElements.define('my-builtin2', MyBuiltinElement2, { extends: 'address'});
let element = document.createElementNS('urn:example', 'address', { is: 'my-builtin2' });
assert_false(element instanceof MyBuiltinElement2);
assert_false(element.hasAttribute('is'));
}, 'builtin: document.createElementNS should check namespaces.');

test(() => {
class SuperP extends HTMLParagraphElement {}
customElements.define("super-p", SuperP, { extends: "p" });

const superP = document.createElementNS("http://www.w3.org/1999/xhtml", "p", { is: "super-p" });
assert_true(superP instanceof HTMLParagraphElement);
assert_true(superP instanceof SuperP);
assert_equals(superP.localName, "p");

const notSuperP = document.createElementNS("http://www.w3.org/1999/xhtml", "p", "super-p");
assert_true(notSuperP instanceof HTMLParagraphElement);
assert_false(notSuperP instanceof SuperP);
assert_equals(notSuperP.localName, "p");
}, "document.createElementNS()'s third argument is to be ignored when it's a string");
</script>
</body>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

FAIL If extends is a-, should throw a NotSupportedError assert_throws_dom: function "() => {
customElements.define('test-define-extend-valid-name', class {}, { extends: name });
}" did not throw
PASS If extends is a-a, should throw a NotSupportedError
PASS If extends is aa-, should throw a NotSupportedError
PASS If extends is aa-a, should throw a NotSupportedError
PASS If extends is a-.-_, should throw a NotSupportedError
PASS If extends is a-0123456789, should throw a NotSupportedError
PASS If extends is a-漢字, should throw a NotSupportedError
PASS If extends is a-𠀋, should throw a NotSupportedError
FAIL If extends is bgsound, should throw a NotSupportedError assert_throws_dom: function "() => {
customElements.define('test-define-extend-' + name, class {}, { extends: name });
}" did not throw
FAIL If extends is blink, should throw a NotSupportedError assert_throws_dom: function "() => {
customElements.define('test-define-extend-' + name, class {}, { extends: name });
}" did not throw
FAIL If extends is isindex, should throw a NotSupportedError assert_throws_dom: function "() => {
customElements.define('test-define-extend-' + name, class {}, { extends: name });
}" did not throw
FAIL If extends is multicol, should throw a NotSupportedError assert_throws_dom: function "() => {
customElements.define('test-define-extend-' + name, class {}, { extends: name });
}" did not throw
FAIL If extends is nextid, should throw a NotSupportedError assert_throws_dom: function "() => {
customElements.define('test-define-extend-' + name, class {}, { extends: name });
}" did not throw
FAIL If extends is spacer, should throw a NotSupportedError assert_throws_dom: function "() => {
customElements.define('test-define-extend-' + name, class {}, { extends: name });
}" did not throw
FAIL If extends is elementnametobeunknownelement, should throw a NotSupportedError assert_throws_dom: function "() => {
customElements.define('test-define-extend-' + name, class {}, { extends: name });
}" did not throw

Loading

0 comments on commit f0f68a8

Please sign in to comment.