New issue
Advanced search Search tips

Issue 814644 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 648828



Sign in to add a comment

An element created with 0-length 'is' should not match to ':defined'

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

Issue description

Chrome Version: 66 canary
OS: All but iOS

What steps will reproduce the problem?
(1) Enable chrome://flags/#enable-experimental-web-platform-features
(1) Run the following code in DevTools console
  document.createElement('div', {is:''}).matches(':defined')

What is the expected result?
Show 'false'

What happens instead?
Show 'true'

Please use labels and text to provide additional information.
According to the DOM standard, the element should be "undefined" state.

https://dom.spec.whatwg.org/#dom-document-createelement
> 3. Let is be the value of the is member of options, or null if no such member exists.

https://dom.spec.whatwg.org/#concept-create-element
> 7.3. If namespace is the HTML namespace, and either localName is a valid custom element name or is is non-null, then set result’s custom element state to "undefined".


 

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

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

Comment 2 by bugdroid1@chromium.org, Feb 23 2018

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

commit 196fc5b6ef0ac459c834b8e6eab3ca1a6a2c1654
Author: Kent Tamura <tkent@chromium.org>
Date: Fri Feb 23 03:55:32 2018

custom-elements: An element created with 0-length 'is' should be 'undefined' state.

createElement() should accept 0-length 'is' string though
window.customElements.define() doesn't accept it and web authors
can't define such custom elements.

createElement() never finds custom element definition for 0-length 'is'.
So the state of the created elements should be 'undefined'.

https://dom.spec.whatwg.org/#dom-document-createelement
> 3. Let is be the value of the is member of options, or null if no such
> member exists.

https://dom.spec.whatwg.org/#concept-create-element
> 7.3. If namespace is the HTML namespace, and either localName is a
> valid custom element name or is is non-null, then set result’s custom
> element state to "undefined".

The code before this CL incorrectly rejected 0-length 'is' value, and
made the element state 'uncustomized'.
IsEmpty() checks for "is" values should be IsNull().

Bug:  814644 
Change-Id: I273f4aa07dd029e483365a9b31586297862a7140
Reviewed-on: https://chromium-review.googlesource.com/930941
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538692}
[modify] https://crrev.com/196fc5b6ef0ac459c834b8e6eab3ca1a6a2c1654/third_party/WebKit/LayoutTests/external/wpt/custom-elements/pseudo-class-defined.html
[modify] https://crrev.com/196fc5b6ef0ac459c834b8e6eab3ca1a6a2c1654/third_party/WebKit/Source/core/dom/Document.cpp
[modify] https://crrev.com/196fc5b6ef0ac459c834b8e6eab3ca1a6a2c1654/third_party/WebKit/Source/core/html/custom/CustomElement.cpp

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

Status: Fixed (was: Started)

Sign in to add a comment