Bug 1439599 [wpt PR 9586] - createElement()/createElementNS() dictionary argument can be a string, a=testonly

Automatic update from web-platform-testscreateElement()/createElementNS() dictionary argument can be a string

Helps with https://github.com/whatwg/dom/pull/572.

wpt-commits: 2a181b39ebedeb3b2d826fb5f320a7871e0eff08
wpt-pr: 9586
wpt-commits: 2a181b39ebedeb3b2d826fb5f320a7871e0eff08
wpt-pr: 9586
This commit is contained in:
Anne van Kesteren 2018-03-26 13:07:02 +00:00 коммит произвёл James Graham
Родитель 48d8067616
Коммит f6e28fdbfe
4 изменённых файлов: 35 добавлений и 5 удалений

Просмотреть файл

@ -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": [

Просмотреть файл

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

Просмотреть файл

@ -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");
</script>
</body>

Просмотреть файл

@ -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);