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

Issue 666166 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Nov 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 648828



Sign in to add a comment

Specifying an 'is' attribute on an autonomous custom element should have no effect

Project Member Reported by yurak@google.com, Nov 17 2016

Issue description

When an autonomous custom element definition exists named 'a-a',

createElement('a-a', {is: 'b-b'})

should create the autonomous custom element definition regardless of if a custom element definition with name 'b-b' exists.

The current implementation throws a NotFoundError.
 
Where do you see that in the spec? That section in particular definitely does not support it.

Comment 2 by yurak@google.com, Nov 17 2016

"Any namespace-less attribute that is relevant to the element's functioning, as determined by the element's author, may be specified on an autonomous custom element, so long as the attribute name is XML-compatible and contains no uppercase ASCII letters. The exception is the is attribute, which must not be specified on an autonomous custom element (and which will have no effect if it is)."

My implementation wasn't doing this properly.
That's a conformance requirement for authors, telling them what they must write to have valid HTML. It doesn't affect implementations, which must process is attributes according to the normative parts of the spec's processing model.

Comment 4 by yurak@google.com, Nov 17 2016

If someone creates an element with createElement('a-a', {is: 'b-b'}) it should create an autonomous custom element with definition of 'a-a' with 'is' attribute set to 'b-b', right?

In this case my implementation was looking for a custom element definition with name 'b-b' and localName 'a-a', which doesn't exist.
> If someone creates an element with createElement('a-a', {is: 'b-b'}) it should create an autonomous custom element with definition of 'a-a' with 'is' attribute set to 'b-b', right?

Well, I'm not sure? What does the spec say? Let me walk you through the process of finding out. Note how the section you quoted is never involved as it does not give any normative algorithm steps for createElement.

1. We start at https://dom.spec.whatwg.org/#dom-document-createelement and go to step 5
2. That takes us to https://dom.spec.whatwg.org/#concept-create-element passing document, 'a-a', the HTML namespace, null, 'b-b', and with the synchronous custom elements flag set.
3. Step 4 takes us to https://html.spec.whatwg.org/multipage/scripting.html#look-up-a-custom-element-definition passing document, the HTML namespace, 'a-a', and 'b-b'
4. In this algorithm, does step 4's condition hold? Maybe, if previously 'a-a' has been defined as an autonomous custom element. Let's call that case (A).
5. If 'a-a' has not been defined, we get to step 5. Is there a custom element definition with name equal to 'b-b' and local name equal to 'a-a'? Maybe. Let's call that case (B).
6. Otherwise, if neither step 4 or step 5's condition hold, we return null. Let's call that case (C).

In case (A), following the logic in https://dom.spec.whatwg.org/#concept-create-element will take us to step 6.1, calling the constructor for a-a which executes the relevant constructor and sets the `is` value to null. Popping back to https://dom.spec.whatwg.org/#dom-document-createelement step 6, we'll set the `is` attribute.

In case (B), we'll end up at step 5, which sets the `is` value to 'b-b' and enqueues an upgrade. Before the upgrade happens, we'll also set the `is` attribute.

And in case (C), we'll end up in step 7, which creates a new undefined element, but sets its `is` value to 'b-b'. We'll also set its `is` attribute.

----

I'm not sure which of case (A), (B), or (C) you were referring to. But in genreal the `is` option will have an effect, definitely. You have to follow the algorithm steps to work through it.

Comment 6 by yurak@google.com, Nov 18 2016

I was referring to case (A), but my implementation wrongly responded with case (B)'s result. This is because I don't conform to the specs in https://dom.spec.whatwg.org/#dom-document-createelement. What I posted in the description above is the part of the spec that reminded me to test case (A) in the first place. I'll update the description to be more specific.

Comment 7 by yurak@google.com, Nov 19 2016

Description: Show this description
Project Member

Comment 8 by bugdroid1@chromium.org, Nov 20 2016

Comment 9 by yurak@google.com, Nov 24 2016

Status: Fixed (was: Started)

Sign in to add a comment