New issue
Advanced search Search tips

Issue 807871 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocked on:
issue 805061

Blocking:
issue 648828



Sign in to add a comment

cloneNode() and importNode() for customized built-in elements should work

Project Member Reported by tkent@chromium.org, Feb 1 2018

Issue description

Chrome Version: ToT
OS: All but iOS

What steps will reproduce the problem?
(1) Open the following HTML document:

<script>
class MyElement extends HTMLDivElement {}
customElements.define('my-div', MyElement, {extends:'div'});
var mydiv = document.createElement('div', {is:'my-div'});
alert(mydiv.cloneNode() instanceof MyElement);
</script>

What is the expected result?
An alert dialog with "true" is opened.

What happens instead?
An alert dialog with "false" is opened.

Please use labels and text to provide additional information.

Element::CloneElementWithoutAttributesAndChildren() should take care of customized built-in elements.
Firefox works well.

 

Comment 1 by tkent@chromium.org, Feb 2 2018

Blockedon: 805061
Project Member

Comment 2 by bugdroid1@chromium.org, 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

Comment 3 by tkent@chromium.org, Feb 5 2018

Owner: tkent@chromium.org
Status: Started (was: Available)
Project Member

Comment 4 by bugdroid1@chromium.org, 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

Project Member

Comment 5 by bugdroid1@chromium.org, Feb 8 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/eefda00ac65d7a74f1f516a824c20a39fc9f457e

commit eefda00ac65d7a74f1f516a824c20a39fc9f457e
Author: Kent Tamura <tkent@chromium.org>
Date: Thu Feb 08 04:32:28 2018

custom-elements: Introduce Element::IsValue() for "is value"

IsValue() is just a wrapper of FastGetAttribute(HTMLNames::isAttr)
now. However, it will be changed to a (rare) data member of Element in
order to clone customized built-in elements correctly.

This CL has no behavior changes.

Bug:  807871 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ifd7d63159be5596c425b86dcdb51d33ea517a87c
Reviewed-on: https://chromium-review.googlesource.com/908028
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#535298}
[modify] https://crrev.com/eefda00ac65d7a74f1f516a824c20a39fc9f457e/third_party/WebKit/Source/core/dom/Document.cpp
[modify] https://crrev.com/eefda00ac65d7a74f1f516a824c20a39fc9f457e/third_party/WebKit/Source/core/dom/Element.cpp
[modify] https://crrev.com/eefda00ac65d7a74f1f516a824c20a39fc9f457e/third_party/WebKit/Source/core/dom/Element.h
[modify] https://crrev.com/eefda00ac65d7a74f1f516a824c20a39fc9f457e/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
[modify] https://crrev.com/eefda00ac65d7a74f1f516a824c20a39fc9f457e/third_party/WebKit/Source/core/html/custom/CustomElement.cpp
[modify] https://crrev.com/eefda00ac65d7a74f1f516a824c20a39fc9f457e/third_party/WebKit/Source/core/html/custom/CustomElementDescriptor.h
[modify] https://crrev.com/eefda00ac65d7a74f1f516a824c20a39fc9f457e/third_party/WebKit/Source/core/html/custom/CustomElementRegistry.cpp
[modify] https://crrev.com/eefda00ac65d7a74f1f516a824c20a39fc9f457e/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp

Comment 6 by tkent@chromium.org, Feb 13 2018

Summary: cloneNode() and importNode() for customized built-in elements should work (was: cloneNode() for customized built-in elements should work)
Project Member

Comment 7 by bugdroid1@chromium.org, Feb 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e0728d98903c1e95003e3651a6fb0f6779ab6421

commit e0728d98903c1e95003e3651a6fb0f6779ab6421
Author: Kent Tamura <tkent@chromium.org>
Date: Tue Feb 13 08:50:24 2018

custom-elements: Support cloneNode() for customized built-in elements

Element::CloneElementWithoutAttributesAndChildren() should use "create
an element" algorithm with |is| value.

Note that a change in SVGScriptElement.cpp isn't necessary because
Custom Elements V1 doesn't support SVG elements. This CL updates
SVGScriptElement.cpp for consistency and clean code.

WPT: Add cloneNode() tests to custom-elements/builtin-coverage.html.

Bug:  807871 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Iaa7d2781b916e2459ee244540d619cfffcf42427
Reviewed-on: https://chromium-review.googlesource.com/915401
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: Yoichi Osato <yoichio@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536297}
[modify] https://crrev.com/e0728d98903c1e95003e3651a6fb0f6779ab6421/third_party/WebKit/LayoutTests/external/wpt/custom-elements/builtin-coverage.html
[modify] https://crrev.com/e0728d98903c1e95003e3651a6fb0f6779ab6421/third_party/WebKit/Source/core/dom/Element.cpp
[modify] https://crrev.com/e0728d98903c1e95003e3651a6fb0f6779ab6421/third_party/WebKit/Source/core/html/HTMLScriptElement.cpp
[modify] https://crrev.com/e0728d98903c1e95003e3651a6fb0f6779ab6421/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp

Project Member

Comment 8 by bugdroid1@chromium.org, Feb 13 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f0cda17a0152e95bf0f247fbe5723b878e8746f4

commit f0cda17a0152e95bf0f247fbe5723b878e8746f4
Author: Kent Tamura <tkent@chromium.org>
Date: Tue Feb 13 09:16:15 2018

custom-elements: document.importNode() for customized built-in elements should work

importNode() implementation should pass "is" value to "create an
element" algorithm.

WPT: Add a new test for importNode().

Bug:  807871 
Change-Id: Id60c5577b5899aeac66b819986c34a28978e24d9
Reviewed-on: https://chromium-review.googlesource.com/915744
Reviewed-by: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536311}
[add] https://crrev.com/f0cda17a0152e95bf0f247fbe5723b878e8746f4/third_party/WebKit/LayoutTests/external/wpt/custom-elements/upgrading/Document-importNode.html
[modify] https://crrev.com/f0cda17a0152e95bf0f247fbe5723b878e8746f4/third_party/WebKit/Source/core/dom/Document.cpp

Project Member

Comment 9 by bugdroid1@chromium.org, Feb 20 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369

commit c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369
Author: Kent Tamura <tkent@chromium.org>
Date: Tue Feb 20 08:15:11 2018

custom-elements: Customized built-in elements created by 'new' should be cloneable.

This follows a DOM specification change;
https://github.com/whatwg/dom/pull/566

- createElement() and createElementNS() don't add "is" content
  attribute
- cloneNode() should refer "is value" instead of "is" content attribute
  value.

This CL adds a data member for "is value" to ElementRareData, and
initialize it in "create an element" implementation.

Note that new failure for serializing-html-fragments.html is expected.
It will be fixed for  crbug.com/813675 .

Bug:  807871 
Change-Id: Ie7c5f6282dd1a84a3d159b89d0d4efd72b0ddee0
Reviewed-on: https://chromium-review.googlesource.com/925901
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537736}
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/LayoutTests/custom-elements/spec/create-element.html
[rename] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/LayoutTests/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt
[delete] https://crrev.com/0c236612e5b506d3b1e3ab9b75b3a355e2ba620f/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/Document-createElement-expected.txt
[delete] https://crrev.com/0c236612e5b506d3b1e3ab9b75b3a355e2ba620f/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/Document-createElementNS-expected.txt
[delete] https://crrev.com/0c236612e5b506d3b1e3ab9b75b3a355e2ba620f/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/builtin-coverage-expected.txt
[delete] https://crrev.com/0c236612e5b506d3b1e3ab9b75b3a355e2ba620f/third_party/WebKit/LayoutTests/platform/mac-mac10.12/external/wpt/custom-elements/upgrading/Node-cloneNode-expected.txt
[delete] https://crrev.com/0c236612e5b506d3b1e3ab9b75b3a355e2ba620f/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/Document-createElement-expected.txt
[delete] https://crrev.com/0c236612e5b506d3b1e3ab9b75b3a355e2ba620f/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/Document-createElementNS-expected.txt
[delete] https://crrev.com/0c236612e5b506d3b1e3ab9b75b3a355e2ba620f/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/builtin-coverage-expected.txt
[delete] https://crrev.com/0c236612e5b506d3b1e3ab9b75b3a355e2ba620f/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/parser/serializing-html-fragments-expected.txt
[delete] https://crrev.com/0c236612e5b506d3b1e3ab9b75b3a355e2ba620f/third_party/WebKit/LayoutTests/platform/win/external/wpt/custom-elements/upgrading/Node-cloneNode-expected.txt
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/dom/Document.cpp
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/dom/Element.cpp
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/dom/Element.h
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/dom/ElementRareData.cpp
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/dom/ElementRareData.h
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/html/custom/CustomElement.cpp
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/html/custom/CustomElementDefinition.cpp
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/html/custom/CustomElementDescriptorTest.cpp
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/html/custom/CustomElementRegistryTest.cpp
[modify] https://crrev.com/c1e3ad78aad7b941387aae3fc7b2cf4c7b98d369/third_party/WebKit/Source/core/html/custom/CustomElementTestHelpers.h

Comment 10 by tkent@chromium.org, Feb 20 2018

Status: Fixed (was: Started)

Sign in to add a comment