New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 637353 link

Starred by 9 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug

Blocked on:
issue 692048

Blocking:
issue 660758



Sign in to add a comment

2nd arg of document.createElement should be an object

Project Member Reported by ericbidelman@chromium.org, Aug 12 2016

Issue description

The 2nd argument to d.createElement is now an object (https://dom.spec.whatwg.org/#dom-document-createelement):

    document.createElement('button', {is: 'fancy-button'});

However, this returns <button is="[object Object]"> in Blink. 

Blinks implementation is for the older spec:

    document.createElement('button', 'fancy-button');

FF is trying to ship v1 and running into compatibility issues: https://bugzilla.mozilla.org/show_bug.cgi?id=1294100

Can we...
1.) implement the new call as spec'd
2.) support both syntaxes in Blink for now, and console warn if users use the outdated call
3.) After some time deprecated the first call
 
Labels: -Pri-3 Pri-2
Owner: dominicc@chromium.org
Status: Available (was: Untriaged)
Thanks for filing this! Tentatively me. String to dictionary is an (ancient) spec change we never implemented.

Our implementation separates v0 and v1 custom elements pretty explicitly. We will not support a string argument for v1 elements. We don't support v1 customized built-in elements yet.

We'll deprecate the string version for v0 elements along with the rest of v0.
Hi Dominic,

I could help with this one. Are you guys already implementing v1 customized built-in elements? May be I could jump in.
 


Sure, please go ahead.

I want very specific way of handling this parameter when customized built-in elements are implemented (soon.)

For now, just handling the dictionary, but also accepting a string (maybe using toString?) but with a deprecation warning for the string, would be good.
Thanks, will do.
Hi, I made a draft patch.
https://codereview.chromium.org/2334223005

Plz check if I am going in the right direction.

Comment 6 by hayato@chromium.org, Oct 12 2016

Components: -Blink>WebComponents -Blink>DOM Blink>HTML>CustomElements
Cc: yurak@google.com
Owner: a.obzhirov@samsung.com
Status: Started (was: Available)
Hi Anton, what's happening with this? The blink-dev thread got enough LGTMs to ship the new option, but not add the deprecation message to the string, string version yet--just the use counter.

It would be good to get this in the tree soon. yurak is implementing customized built-in elements which needs this parameter.
Hi, sorry for delay - was on holiday last week and was actually waiting for your reply on one of my emails. Will update the patch and try to merge it today.
Project Member

Comment 9 by bugdroid1@chromium.org, Oct 27 2016

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

commit fc17d505758c284f99624ac69b6e2fb72ea7b623
Author: a.obzhirov <a.obzhirov@samsung.com>
Date: Thu Oct 27 19:33:32 2016

2nd arg of document.createElement should be an object

This patch adds a dictionary as a second argument for document.createElement.
See https://dom.spec.whatwg.org/#dom-document-createelement.

BUG= 637353 

Review-Url: https://codereview.chromium.org/2334223005
Cr-Commit-Position: refs/heads/master@{#428111}

[add] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/LayoutTests/fast/dom/custom/create-element-second-arg.html
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/bindings/core/v8/BUILD.gn
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/bindings/core/v8/V0CustomElementConstructorBuilder.cpp
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/core/core_idl_files.gni
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/core/dom/Document.cpp
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/core/dom/Document.h
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/core/dom/Document.idl
[add] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/core/dom/ElementCreationOptions.idl
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/core/dom/TreeScopeTest.cpp
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/core/dom/custom/CustomElementUpgradeSorterTest.cpp
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/third_party/WebKit/Source/core/frame/UseCounter.h
[modify] https://crrev.com/fc17d505758c284f99624ac69b6e2fb72ea7b623/tools/metrics/histograms/histograms.xml

Hi Dominic,

The patch is merged without the deprecation message. I guess now we would need to wait some time to get use count for string argument. Do we keep this bug open for now?
Blocking: 660758
Labels: OS-Android OS-Chrome OS-Linux OS-Mac OS-Windows
Status: Fixed (was: Started)
Awesome, thank you so much. I've filed Issue 660758 to track the deprecation since it will take ages for the use counter data to come in.
Blockedon: 662329
Blockedon: -662329
Blockedon: 692048

Sign in to add a comment