Re: [WICG/webcomponents] [scoped-registries] Element upgrade ordering (#923)

1. I found it harder to implement in Chromium. It requires adding new index structures, while what I proposed can fully make use of existing structures in Chromium.
And document creation time order shouldn't be hard to implement in other engines (if I read the code correctly):
   - WebKit currently doesn't maintain any data structure for upgrades but  [traverses the full document](https://github.com/WebKit/WebKit/blob/main/Source/WebCore/dom/CustomElementRegistry.cpp#L96), so it's free to add any index structure
   - [Gecko's current implementation](https://github.com/mozilla/gecko-dev/blob/23808d46cde6155213b1230675b00a0a426f466e/dom/base/CustomElementRegistry.cpp#L712) seems similar to Chromium, so it doesn't require any additional index structure for document creation time order, either.

2. I think an ordering is simpler for spec and developers if it depends less on the past states

Since what we want is just a fixed ordering without implementation or performance issues, if there are multiple orderings to choose, we should choose the simplest one.

> Document creation-time is also not something we expose today or use as a primitive as far as I know

I was inspired by [this](https://html.spec.whatwg.org/multipage/nav-history-apis.html#windowproxy-getownproperty), which uses child frame insertion time but doesn't quite expose it as a primitive:

> [Sort](https://infra.spec.whatwg.org/#list-sort-in-ascending-order) children in ascending order, with navigableA being less than navigableB if navigableA's [container](https://html.spec.whatwg.org/multipage/document-sequences.html#nav-container) was inserted into W's [associated Document](https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-document-window) earlier than navigableB's [container](https://html.spec.whatwg.org/multipage/document-sequences.html#nav-container) was.

Since we can use frame insertion time, maybe we can also use document creation time in a similar manner?

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/923#issuecomment-1741503120
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/923/1741503120@github.com>

Received on Friday, 29 September 2023 21:22:33 UTC