-
Notifications
You must be signed in to change notification settings - Fork 686
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
[css-conditional-4][selectors-4] How should selector supports test react to partially-implemented selectors? #3936
Comments
I don't think this is particularly urgent to fix since no UAs implement those, but I would probably suggest either:
But maybe that's not even an issue since |
That seems bad, it should be possible to code and know without throwing, don't you think? I think the |
I believe that "optional" shouldn't mean anything more than "up to the implementer". If somebody who (against all reason) implements this selector for scripting only decides to make this check return true, let it be so. If they prefer to return false for the sake of consistency with CSS, let them do so. Anyways, I'd wager that this would stay a purely theoretical issue for a very long time because in reality 99% of JS developers would never use this check at all, simply switching from the conditional one-liner with the exotic selector to the unconditional two-liners with common selectors proven to work everywhere (not to mention that direct DOM traversal is much less used at all in modern JS than it was in the jQuery era). This would likely lead to the same "no one implemented → no one uses → no one asks for → no one wants to implement" deadlock that I believe we have actually observed in reality since the Please, don't bring back the concept of "snapshot profile" in any form! Disabling CSS selectors for styling as a solution to the performance problem is virtually equal to not introducing them at all. Let's try to find better solutions to the performance problem first. As a starting point for brainstorming: maybe restricting the scope of |
On reflection, I tend to think that consistency with CSS is better. Because probably the most common use case for this check would be detecting the need for polyfill/alternative to the |
Agenda+ to ask if we want to close no-change (can already check by seeing if .querySelector throws) or if we want to add a new API that specifically checks for .querySelector support. |
Close no change, imo. Using a raised error as a flag isn't elegant, but it works acceptably as long as it's well-specified, so I'm fine with that. |
The CSS Working Group just discussed
The full IRC log of that discussion<fantasai> Topic: [css-conditional-4][selectors-4] How should selector supports test react to partially-implemented selectors?<TabAtkins> github: https://github.com//issues/3936 <TabAtkins> fantasai: So it's about how supports() should work for "partially-implemented" selectors (only implemented in some contexts) <TabAtkins> fantasai: And if we need a separate supports*() function to differentiate them. <fantasai> TabAtkins: :has() psueudo-class, was suggested could be implemented just in .querySelector and not in CSS <fantasai> TabAtkins: Question about whether @supports/.supports() return true fo rsupport in that case <fantasai> TabAtkins: Conclusion was that only true if supported in CSS <fantasai> TabAtkins: and can tell if .querySelector supports by whether or not it throws <fantasai> TabAtkins: So shouldn't need additional work <TabAtkins> astearns: So anyone interested in keeping the issue open, or okay with closing? <TabAtkins> astearns: Objections to closing? <TabAtkins> astearns: I trust if Amelia disagrees we'll hear about it <TabAtkins> RESOLVED: Close no-change <fantasai> proposed: .supports/@supports checks for support in CSS, use .querySelector throwing to check for support there, close no change |
In #3207, it was agreed to add a
selector()
notation to@supports
. Draft spec for CSS Conditional Level 4.This would presumably also apply to the
CSS.supports(condition)
API.However, I don't think there was any discussion about how this would interact with "selector profiles" — certain selectors that were expected to be implemented only in DOM methods and not in CSS parsing. In #3925, the WG resolved to drop the idea of selector profiles, but instead to mark
:has()
(and potentially other selectors with performance concerns) as optional. There was a suggestion that “optional” could mean following the profile pattern of supporting some selectors inquerySelector
etc. that aren't supported in markup.So my question: if that is allowed, what should
CSS.supports("selector(parent:has(child))")
return? The same as@supports selector(parent:has(child))
?The text was updated successfully, but these errors were encountered: