Commit 8b41ba11 authored by Kent Tamura's avatar Kent Tamura Committed by Commit Bot

custom-elements: Element created by createElementNS(ns, qname, options) with...

custom-elements: Element created by createElementNS(ns, qname, options) with valid custom element name and undefined options should be upgraded immediately

createElementNS(XHTML_NS, 'my-element', undefined) was not being
upgraded immediatedly, though both createElementNS(XHTML_NS,
'my-element') and createElementNS(XHTML_NS, 'my-element', {}) were.

Bug: 841725
Change-Id: Iccc4f0e98b1de65288381dd9ac106e71bfc5d0c8
Reviewed-on: https://chromium-review.googlesource.com/1096812Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566374}
parent 14eab243
......@@ -31,6 +31,14 @@ test(() => {
assert_false((new Document()).createElementNS(xhtmlNS, 'x-foo', {}) instanceof HTMLUnknownElement);
}, 'autonomous: document.createElementNS should not create HTMLUnknownElement for a valid custom element name');
test(() => {
class MyElement3 extends HTMLElement {};
customElements.define('my-autonomous3', MyElement3);
const instance = document.createElementNS('http://www.w3.org/1999/xhtml', 'my-autonomous3', undefined);
assert_true(instance instanceof MyElement3);
}, 'autonomous: document.createElementNS with undefined options value should be upgraded.');
test(() => {
class MyBuiltinElement extends HTMLElement {};
......
......@@ -1046,6 +1046,9 @@ Element* Document::createElementNS(const AtomicString& namespace_uri,
const AtomicString& qualified_name,
const StringOrDictionary& string_or_options,
ExceptionState& exception_state) {
if (string_or_options.IsNull())
return createElementNS(namespace_uri, qualified_name, exception_state);
// 1. Validate and extract
QualifiedName q_name(
CreateQualifiedName(namespace_uri, qualified_name, exception_state));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment