Can't create customized built-in elements with prefixes |
|||
Issue description
Chrome Version: 66 canary
OS: All but iOS
What steps will reproduce the problem?
(1) Open the following URL:
data:text/html;charset=utf-8,<body><script> class PlasticDiv extends HTMLDivElement {} customElements.define('plastic-div', PlasticDiv, { extends: 'div' }); var pdiv = document.createElementNS('http://www.w3.org/1999/xhtml', 'p:div', {is:'plastic-div'}); alert(pdiv instanceof PlasticDiv);</script>
What is the expected result?
An alert dialog with "true" is opened.
What happens instead?
No alert dialog.
DevTools console has:
Uncaught DOMException: Failed to execute 'createElementNS' on 'Document': Custom element definition not found.
Firefox works as expected.
,
Jan 30 2018
As for autonomous custom elemnts, both of Chrome and Firefox have this issue.
data:text/html;charset=utf-8,<body><script> class FlagIcon extends HTMLElement {} customElements.define('flag-icon', FlagIcon); var fi = document.createElementNS('http://www.w3.org/1999/xhtml', 'p:flag-icon'); alert(fi.prefix);</script>
This URL should show an alert dialog with "p", but it's "null".
,
Jan 30 2018
,
Jan 30 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/18ac0a07d07f8687258809c8b98c678167e6ae7c commit 18ac0a07d07f8687258809c8b98c678167e6ae7c Author: Kent Tamura <tkent@chromium.org> Date: Tue Jan 30 09:41:08 2018 custom-elements: document.createElementNS() should set prefixes to custom elements. We had a bug that createElementNS() ignored prefixes. New behavior matches to the specification and Firefox. * Document-createElementNS.html: Fix a copypasta error. * ScriptCustomElementDefinition::CreateElementSync: Implement Step 6.1.10. * Document::createElementNS: Fix an argument of definition lookup. * CustomElement::CreateUndefinedElement: Use Document::CreateRawElement(), which sets prefixes correctly, instead of HTMLElementFactory::createHTMLElement(). * ustomElementDefinition::CreateElementAsync: Use Document::CreateRawElement(), which sets prefixes correctly, instead of HTMLElementFactory::createRawHTMLElement(). Bug: 806639 Change-Id: I74b431d4475d7cf84f65ab0ff1b24773cbc64079 Reviewed-on: https://chromium-review.googlesource.com/892802 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#532821} [delete] https://crrev.com/1017eb9143e734793d735b46a1a0ce1adb52120b/third_party/WebKit/LayoutTests/external/wpt/custom-elements/Document-createElementNS-expected.txt [modify] https://crrev.com/18ac0a07d07f8687258809c8b98c678167e6ae7c/third_party/WebKit/LayoutTests/external/wpt/custom-elements/Document-createElementNS.html [modify] https://crrev.com/18ac0a07d07f8687258809c8b98c678167e6ae7c/third_party/WebKit/Source/bindings/core/v8/ScriptCustomElementDefinition.cpp [modify] https://crrev.com/18ac0a07d07f8687258809c8b98c678167e6ae7c/third_party/WebKit/Source/core/dom/Document.cpp [modify] https://crrev.com/18ac0a07d07f8687258809c8b98c678167e6ae7c/third_party/WebKit/Source/core/html/custom/CustomElement.cpp [modify] https://crrev.com/18ac0a07d07f8687258809c8b98c678167e6ae7c/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp
,
Jan 30 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by tkent@chromium.org
, Jan 29 2018