Customized builtin elements don't work in innerHTML |
|||
Issue description
Chrome Version: 66 canary with --enable-blink-features=CustomElementsBuiltin flag
OS: All but iOS
What steps will reproduce the problem?
(1) Launch Chrome, Chromium, or content_shell with --enable-blink-features=CustomElementsBuiltin flag
(2) Open the following URL:
data:text/html;charset=utf-8,<body> <div class="container"></div> <script> class PlasticDiv extends HTMLDivElement { constructor() { super(); } connectedCallback() { this.style.color = 'blue'; } } customElements.define('plastic-div', PlasticDiv, { extends: 'div' }); document.querySelector('.container').innerHTML = '<div is="plastic-div">Plastic!</div>'; </script> <div is="plastic-div">Plastic 2!</div> </body>
What is the expected result?
Blue "Plastic!" and blue "Plastic 2!" are shown.
What happens instead?
Black "Plastic!" and blue "Plastic 2!" are shown.
Please use labels and text to provide additional information.
The former is created via innerHTML, the latter is created by document-level parser.
Firefox Nightly 60.0a1 works correctly.
,
Jan 26 2018
Looks like a bug of HTMLConstructionSite::CreateElement(). https://html.spec.whatwg.org/multipage/parsing.html#create-an-element-for-the-token Step 7 asks to run "creating an element" with "is" value. However, the current code calls document.createElement() without "is" value if "will execute script" is false.
,
Jan 26 2018
,
Jan 27 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/a187c5b1c5c5280ddb006c228e45e25683860427 commit a187c5b1c5c5280ddb006c228e45e25683860427 Author: Kent Tamura <tkent@chromium.org> Date: Sat Jan 27 02:44:37 2018 Make a separated header file for blink::CreateElementFlags We're going to use blink::CreateElementFlags in more header files, and would like to avoid to include huge Document.h. This CL has no behavior changes. Bug: 805280 Change-Id: I64c89995cda3f76f1e75b6cf20af05f0e8eb2e24 Reviewed-on: https://chromium-review.googlesource.com/888191 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#532134} [modify] https://crrev.com/a187c5b1c5c5280ddb006c228e45e25683860427/third_party/WebKit/Source/core/dom/BUILD.gn [add] https://crrev.com/a187c5b1c5c5280ddb006c228e45e25683860427/third_party/WebKit/Source/core/dom/CreateElementFlags.h [modify] https://crrev.com/a187c5b1c5c5280ddb006c228e45e25683860427/third_party/WebKit/Source/core/dom/Document.h
,
Jan 29 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/1c6d493beeda1b183a95c41598160f6ff51fbaf3 commit 1c6d493beeda1b183a95c41598160f6ff51fbaf3 Author: Kent Tamura <tkent@chromium.org> Date: Mon Jan 29 02:41:16 2018 custom-elements: Customized built-in elements should work in innerHTML. HTMLConstructionSite should call CustomElementDefinition:: CreateElementAsync() if it's in fragment parsing mode. - Separate HTMLElementFactory::createHTMLElement() into two. CreateElementAsync() uses the first part of separated functions. Bug: 805280 Change-Id: I2e2dafcd33c033c87c3accaca7c1b00c56474591 Reviewed-on: https://chromium-review.googlesource.com/890680 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#532308} [modify] https://crrev.com/1c6d493beeda1b183a95c41598160f6ff51fbaf3/third_party/WebKit/LayoutTests/external/wpt/custom-elements/builtin-coverage-expected.txt [modify] https://crrev.com/1c6d493beeda1b183a95c41598160f6ff51fbaf3/third_party/WebKit/Source/build/scripts/templates/element_factory.cc.tmpl [modify] https://crrev.com/1c6d493beeda1b183a95c41598160f6ff51fbaf3/third_party/WebKit/Source/build/scripts/templates/element_factory.h.tmpl [modify] https://crrev.com/1c6d493beeda1b183a95c41598160f6ff51fbaf3/third_party/WebKit/Source/core/html/custom/CustomElement.cpp [modify] https://crrev.com/1c6d493beeda1b183a95c41598160f6ff51fbaf3/third_party/WebKit/Source/core/html/custom/CustomElement.h [modify] https://crrev.com/1c6d493beeda1b183a95c41598160f6ff51fbaf3/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp [modify] https://crrev.com/1c6d493beeda1b183a95c41598160f6ff51fbaf3/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.h [modify] https://crrev.com/1c6d493beeda1b183a95c41598160f6ff51fbaf3/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp
,
Jan 29 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by tkent@chromium.org
, Jan 24 2018