Closed domenic closed 2 years ago
@domenic I currently have two groups to categorize this pseudo-class:
which one group do you believe this pseudo-class should fall under ?
And ... could we assume that one of these checks:
is a good enough resolver for correctly matching this pseudo-class ?
I think these pseudo-classes should never match, at least in jsdom. The spec says
The :autofill and :-webkit-autofill pseudo-classes must match input elements which have been autofilled by user agent. These pseudo-classes must stop matching if the user edits the autofilled field.
and there's no way to detect that from JavaScript. The proposal of input.defaultValue.length > 0
will match the following HTML (even without any autofilling taking place):
<input type="text" value="some default value">
(but it should not). And the proposal of input.defaultValue.length > 0 && input.defaultValue != input.value
will match the following:
<input type="text" value="some default value">
<script>
document.querySelector("input").value = "a non-default value";
</script>
(but it should not).
which one group do you believe this pseudo-class should fall under ?
Sorry for missing this question. I don't think those categories exist in any spec, so it's just a matter of taste, right? I guess I would say "user interface and form pseudo-classes".
Any progress? I really wish if I could mute the error from jsdom when I use those pseudo-classes.
:autofill
and :-webkit-autofill
should be categorized into input pseudo-classes for browsers only attach them to input elements.
MDN also do so.
https://developer.mozilla.org/en-US/docs/Web/CSS/Pseudo-classes#the_input_pseudo-classes
We don't need any check with them because jsdom has nothing to do with autofill.
Note that Chrome removes :autofill
and :-webkit-autofill
of all input element when user focuses on any one of input, while Firefox does not remove on focus.
Firefox removes those pseudo-classes on value change, and Firefox only removes the pseudo-classes from the only one (changed) input element.
@domenic I am going to release 2.2.2 to npm. I did run jsdom + wpt tests but a further check will let me sleep ;-)
https://html.spec.whatwg.org/#selector-autofill
They should probably never match anything in nwsapi, but it'd be good if they didn't throw exceptions