diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json index 67bbc982a67f..c45746b8a863 100644 --- a/testing/web-platform/meta/MANIFEST.json +++ b/testing/web-platform/meta/MANIFEST.json @@ -542622,11 +542622,11 @@ "testharness" ], "custom-elements/Document-createElement.html": [ - "07de690760040f025455b1588ea00e57c669795f", + "46e64c9f412fb04582f8ec287e08783ac83cb933", "testharness" ], "custom-elements/Document-createElementNS.html": [ - "57791273d1721711dcb456fe7409a734d37278a3", + "da90b2a1c13cf18fd5cade85dcae2dadef6243c9", "testharness" ], "custom-elements/HTMLElement-constructor.html": [ @@ -569338,7 +569338,7 @@ "support" ], "interfaces/dom.idl": [ - "ff96179e520ad069ec36a0ced2a6f2ceb2e8c5da", + "2d65a8029a80cfc97398d18f911f1ae65067e765", "support" ], "interfaces/fullscreen.idl": [ diff --git a/testing/web-platform/tests/custom-elements/Document-createElement.html b/testing/web-platform/tests/custom-elements/Document-createElement.html index 21f024c5735b..ad29b91d88da 100644 --- a/testing/web-platform/tests/custom-elements/Document-createElement.html +++ b/testing/web-platform/tests/custom-elements/Document-createElement.html @@ -50,6 +50,21 @@ test(function () { 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; } diff --git a/testing/web-platform/tests/custom-elements/Document-createElementNS.html b/testing/web-platform/tests/custom-elements/Document-createElementNS.html index 4cc4561f54cf..6377ba63fca1 100644 --- a/testing/web-platform/tests/custom-elements/Document-createElementNS.html +++ b/testing/web-platform/tests/custom-elements/Document-createElementNS.html @@ -49,5 +49,20 @@ test(() => { 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"); diff --git a/testing/web-platform/tests/interfaces/dom.idl b/testing/web-platform/tests/interfaces/dom.idl index 5582fc55acfc..ae65018c71b8 100644 --- a/testing/web-platform/tests/interfaces/dom.idl +++ b/testing/web-platform/tests/interfaces/dom.idl @@ -266,8 +266,8 @@ interface Document : Node { HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); HTMLCollection getElementsByClassName(DOMString classNames); - [NewObject] Element createElement(DOMString localName, optional ElementCreationOptions options); - [NewObject] Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional ElementCreationOptions options); + [NewObject] Element createElement(DOMString localName, optional (DOMString or ElementCreationOptions) options); + [NewObject] Element createElementNS(DOMString? namespace, DOMString qualifiedName, optional (DOMString or ElementCreationOptions) options); [NewObject] DocumentFragment createDocumentFragment(); [NewObject] Text createTextNode(DOMString data); [NewObject] CDATASection createCDATASection(DOMString data);