New issue
Advanced search Search tips

Issue 886991 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Sep 20
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

customized built in element is missing 'is' attribute when programmatically created

Reported by gulle...@gmail.com, Sep 19

Issue description

Chrome Version       : Version 69.0.3497.100 (Official Build) (64-bit)
URLs (if applicable) :
Other browsers tested:
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari:
    Firefox: OK (Version 62, with the experiment flags on)
       Edge:

What steps will reproduce the problem?
(1) Create a customized built-in element thus:
let e = document.createElement('input', {is: 'custom-input'});
	
(2) Observe element's attributes and see that 'is' attribute is NOT present:
e.attributes.length
// console gives 0

(3) When element added as following all is good:
document.body.innerHTML += '<input is="custom-input"/>'

What is the expected result?
Attribute 'is' is expected to be there ALSO when created programmatically.

 
Labels: Needs-Triage-M69
Owner: tkent@chromium.org
Status: WontFix (was: Unconfirmed)
This is a standard-defined behavior.  https://dom.spec.whatwg.org/#concept-create-element doesn't ask to add 'is' content attribute.

I confirmed Firefox 64 nightly didn't add 'is' content attribute.

Let me ensure that we are on the same page, before trying out other solutions.

One bit of info was missing in my description (well it is implicitly seen from the steps, but let me word it): the element is NOT YET defined.

If I'm right (and please prove me if i'm wrong), this case falls under punkt 7 in the spec (titled "Otherwise"), which reads in its punkt 2: "..., is value set to is".

So how do you read it - set some internal "is" property to "is", but not necessarily add "is" attribute?

Let's say that it is right: how can one detect undefined element (customized)?
> So how do you read it - set some internal "is" property to "is", but not necessarily add "is" attribute?

That's right. "is value set to is" doesn't mean adding 'is' content attribute.

> how can one detect undefined element (customized)?

!element.matches(':defined') ?


And to stress another point - when the element is added just as an HTML (not programmatically) - the "is" attribute preserved. So I'd expect the behavior to be symmetric.
!element.matches(':defined') is nice, but I'm still missing an ability to get the customized element's name (extended one).

In short: my framework needs to determine that some element is not defined and set watcher on its 'whenDefined'.
'is' attribute would give me that name.
>  I'm still missing an ability to get the customized element's name (extended one).

Yeah, it's missing.  You should raise a feature request on https://github.com/whatwg/html/issues. Maybe just adding readonly 'is' IDL attribute returning 'is value' would be enough.


Opened the following issue: https://github.com/whatwg/html/issues/4043

How should we proceed with this one - it is closed already, so should I do anything else here?
I must say that i feel like we still not fully resolved the data available to us here.
Let me focus on 2 points:
- someElement.innerHTML = '<input is="custom-input"/>'
in this case, element will be created and added to DOM and WILL HAVE an 'is' attribute set to 'custom-input'

- document.createElement('input', { is: 'custom-input' })
in this case, there is no attribute as we know, but when looking onto the outer HTML property i see '<input is="custom-input">', so it looks like 'is' parameter was handled as if it was attribute, yet in somewhat limited way

My point is, that 'is' parameter by spec may be supplied via different API flows and all of them are expected to be reduced to the same data model at the end of the day.

Sign in to add a comment