Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom elements' upgrade order is ambiguous in the case of a detached node #420

Closed
rniwa opened this issue Mar 7, 2016 · 4 comments
Closed

Comments

@rniwa
Copy link
Collaborator

rniwa commented Mar 7, 2016

When a custom element is created but not in any document tree or its shadow-inclusive descendants, the order in which those elements are upgraded is not well defined with the following definition:

https://w3c.github.io/webcomponents/spec/custom/#dfn-upgrade-candidates-map

Each registry has an associated upgrade candidates map of all instances of unresolved elements, mapping a custom element type to a sorted element queue. It is is initially empty.

https://w3c.github.io/webcomponents/spec/custom/#dfn-sorted-element-queue

In addition to an element queue, there is also a sorted element queue. The custom elements are kept in the order of increasing custom element order.

@rniwa
Copy link
Collaborator Author

rniwa commented Mar 7, 2016

Also see the issue #419. Perhaps elements detached from a document is not supposed to be upgraded?

Now, I would really prefer upgrading custom elements in the order they were instantiated by the DOM API / HTML parser because that would avoid a rather expensive O(n) operation to figure out the relative ordering of each custom element at the time defineElement is called.

Given that the number of an upgradable element of a particular name is probably much smaller than the total number of elements in a page, this approach is less than ideal.

@domenic
Copy link
Collaborator

domenic commented Mar 7, 2016

Now, I would really prefer upgrading custom elements in the order they were instantiated by the DOM API / HTML parser

I think that is the intent of the spec's "document custom element order" concept. However, it would be better if this were an explicit list tracked by the parser and createElement.

@domenic
Copy link
Collaborator

domenic commented Mar 8, 2016

I guess this will be solved as part of #424.

@domenic
Copy link
Collaborator

domenic commented Mar 8, 2016

I believe this is explicit now, given https://w3c.github.io/webcomponents/spec/custom/#dfn-create-element is clear about when it enqueues a custom element upgrade or it enqueues the element in the appropriate upgrade queue. However, there is still #419 to resolve.

@domenic domenic closed this as completed Mar 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants