Re: [whatwg/dom] Add "precustomized" custom element state (#894)

@mfreed7 commented on this pull request.



> @@ -5875,19 +5875,19 @@ dictionary ShadowRootInit {
 initialized.
 
 <p>An <a for=/>element</a>'s <a for=Element>custom element state</a> is one of
-"<code>undefined</code>", "<code>failed</code>", "<code>uncustomized</code>", or
-"<code>custom</code>". An <a for=/>element</a> whose <a for=Element>custom element state</a> is
-"<code>uncustomized</code>" or "<code>custom</code>" is said to be
-<dfn export id=concept-element-defined for=Element>defined</dfn>. An <a for=/>element</a> whose
-<a for=Element>custom element state</a> is "<code>custom</code>" is said to be
-<dfn export id=concept-element-custom for=Element>custom</dfn>.
+"<code>undefined</code>", "<code>failed</code>", "<code>uncustomized</code>",
+"<code>precustomized</code>", or "<code>custom</code>". An <a for=/>element</a> whose <a
+for=Element>custom element state</a> is "<code>uncustomized</code>", "<code>precustomized</code>",

So we already have [a test for :defined](https://github.com/web-platform-tests/wpt/blob/master/custom-elements/pseudo-class-defined.html#L103) during an upgrade, and I think it's good enough to catch problems here. Note a couple things:
 * `:defined` already doesn't match during an upgrade, even **after** `super()`, because the custom element state is only set to "custom" [after the constructor completes](https://html.spec.whatwg.org/#upgrades).
 * Testing `:defined` prior to `super()` shouldn't be typical anyway, since you can't access `this` prior to `super()`. You could use an external reference to the element to test, of course, but that doesn't seem like it'd be common.

I'm sure I'm missing something here - please let me know what it is, and what you'd like me to test for. I can add a test for the second bullet above, but it doesn't seem terribly useful. It would catch the case where `:defined` matches **prior** to `super()` but stops matching it **after** `super()`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/894#discussion_r495149826

Received on Friday, 25 September 2020 18:05:18 UTC