XML parser should support customized built-in elements |
|||
Issue descriptionChrome Version: ToT OS: All but iOS What steps will reproduce the problem? (1) Save the following document as foo.xhtml <?xml version="1.0"?> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <script> class MyElement extends HTMLDivElement { constructor() { super(); } connectedCallback() { this.style.color = 'blue'; } } customElements.define('my-element', MyElement, { extends: 'div' }); </script> <div is="my-element">My element</div> </body> </html> (2) Load it What is the expected result? Blue "My element" is shown. What happens instead? Black "My element" is shown. Please use labels and text to provide additional information. For XHTML documents, we use XML parser. The specification asks to use "create an element for a token" in XML parser [1], and "create an element for a token" supports customized built-in elements. [1] https://html.spec.whatwg.org/multipage/xhtml.html#parsing-xhtml-documents:create-an-element-for-the-token Our implementation, XMLDocumentParser::StartElementNs(), supports autonomous custom elements because it uses Document::createElement(qname, flags), but it doesn't take care of "is" attribute.
,
Feb 2 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/da0d0c5000a2bb40462601ef8cde0c40f7932fe5 commit da0d0c5000a2bb40462601ef8cde0c40f7932fe5 Author: Kent Tamura <tkent@chromium.org> Date: Fri Feb 02 13:14:39 2018 custom-elements: Handle V0 type extension as close to element creation as possible. Move V0 type extension handling in Element:: AttributeChangedFromParserOrByCloning() to its callsites close to element creation. * HTMLConstructionSite: Move 'is' attribute lookup from LookUpCustomElementDefinition() to CreateElement() in order to avoid looking up 'is' again. * XMLDocumentParser: Convert libxml attributes to blink::Attribute before element creation to find 'is' attribute easily. This CL has no behavior changes, and is a preparation to consolidate V0 type extension handling and element creation. Bug: 808302 , 808311 , 807871 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2 Change-Id: Ibb4254720f1bed8b92e878fa7b29c986bfa1f87d Reviewed-on: https://chromium-review.googlesource.com/898685 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#534035} [modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/dom/Document.cpp [modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/dom/Element.cpp [modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp [modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.cpp [modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/html/parser/HTMLConstructionSite.h [modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp [modify] https://crrev.com/da0d0c5000a2bb40462601ef8cde0c40f7932fe5/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
,
Feb 5 2018
,
Feb 5 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/c692ea5f2087b64de33e59224cf89dacb814590a commit c692ea5f2087b64de33e59224cf89dacb814590a Author: Kent Tamura <tkent@chromium.org> Date: Mon Feb 05 04:05:26 2018 Move V0CustomElementRegistrationContext::SetTypeExtension calls in Document::createElement to Document::CreateElement. Also, fix a bug that V1 createElementNS() produced a type extension defined by V0 registerElement(). This bug was introduced by crrev.com/533660. This CL is a preparation to consolidate V0 type extension handling and element creation. Bug: 808302 , 808311 , 807871 Change-Id: I81251e1c72db4f8f8333f407944a91f2d823bb77 Reviewed-on: https://chromium-review.googlesource.com/900607 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#534324} [modify] https://crrev.com/c692ea5f2087b64de33e59224cf89dacb814590a/third_party/WebKit/LayoutTests/custom-elements/v0-v1-interop.html [modify] https://crrev.com/c692ea5f2087b64de33e59224cf89dacb814590a/third_party/WebKit/Source/core/dom/Document.cpp
,
Feb 5 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/de2c8e5c7a93bdbfbecf266890856b5ec118ac23 commit de2c8e5c7a93bdbfbecf266890856b5ec118ac23 Author: Kent Tamura <tkent@chromium.org> Date: Mon Feb 05 11:20:14 2018 custom-elements: Support custom built-in elements in XML parser. * Enable Document::CreateElement to support both of V0 type extension and V1 custom built-in Merge is_v1 flag to CreateDocumentFlags. It is a tri-state flag; -- Supports only V0, for createElement('div', 'my-div') -- Supports only V1, for createElement('div', {is:'my-div'}) -- Supports both (default) * Enable Document::CreateElement to support asynchronous custom elements creation. Bug: 808302 Change-Id: I4a60bf8a687c0ec93b395d99d816aadb8dfdd4a5 Reviewed-on: https://chromium-review.googlesource.com/901103 Reviewed-by: Yoshifumi Inoue <yosin@chromium.org> Commit-Queue: Kent Tamura <tkent@chromium.org> Cr-Commit-Position: refs/heads/master@{#534364} [add] https://crrev.com/de2c8e5c7a93bdbfbecf266890856b5ec118ac23/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/parser-uses-create-an-element-for-a-token-svg.svg [modify] https://crrev.com/de2c8e5c7a93bdbfbecf266890856b5ec118ac23/third_party/WebKit/Source/core/dom/CreateElementFlags.h [modify] https://crrev.com/de2c8e5c7a93bdbfbecf266890856b5ec118ac23/third_party/WebKit/Source/core/dom/Document.cpp [modify] https://crrev.com/de2c8e5c7a93bdbfbecf266890856b5ec118ac23/third_party/WebKit/Source/core/dom/Document.h [modify] https://crrev.com/de2c8e5c7a93bdbfbecf266890856b5ec118ac23/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
,
Feb 5 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by tkent@chromium.org
, Feb 2 2018