Support for `:matches()`
See original GitHub issueCurrent support only shows in Safari and Firefox and Chrome maintain an older syntax. I think it’s safe to assume :matches()
will eventually be adopted widely by browser vendors.
// Firefox Stable
:-moz-any(a) {
color: blue;
}
// Chrome Stable
:-webkit-any(a) {
color: blue;
}
// Safari Stable
:matches(a) {
color: blue;
}
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:16 (11 by maintainers)
Top Results From Across the Web
matches() DOM method | Can I use... Support tables for ...
matches() DOM method. - LS. Method of testing whether or not a DOM element matches a given selector. Formerly known (and largely supported...
Read more >MATCH function - Microsoft Support
How to use the MATCH function in Excel to search for a specified item in a range of cells, returning the relative position...
Read more >Element.matches() - Web APIs - MDN Web Docs
The matches() method of the Element interface tests whether the element would be selected by the specified CSS selector.
Read more >Regular Expression Matching - LeetCode
Given an input string s and a pattern p , implement regular expression matching with support for '.' and '*' where: '.' Matches...
Read more >re — Regular expression operations — Python 3.11.1 ...
Changed in version 3.5: Added support for group references of fixed length. (?<!...) Matches if the current position in the string is not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@simevidas Thanks for the quick reply! Here’s my use case for reference:
I was hoping to avoid generating every heading combination, especially since this code is nested in another selector in my project, so was going to do this:
However, you‘re probably right that nesting is the best solution for now:
Although it makes me feel good to reduce the amount of generated CSS, I realize the extra bytes are negligible after gzipping 😄.
P.S. Thanks for all the work you do for the web dev community! Been following you on Twitter and reading your blog posts for a long time.
@ai Sorry to reply you so late.
For example, ‘:any’ does not support nesting.
:matches(:matches(h1, h2), h3)
👍:-webkit-any(:-webkit-any(h1, h2), h3)
👎