Intent to Implement :matches()

332 views
Skip to first unread message

Victoria Su

unread,
Dec 21, 2017, 12:56:39 AM12/21/17
to blink-dev

Intent to Implement :matches()


Contact Emails

victor...@google.com


Spec

https://drafts.csswg.org/selectors-4/#matches


Design Doc

https://docs.google.com/document/d/1dfbT1mnIuwm9HTyUWDe5PS5FygZgMuQGsyw49oxBcXk/edit?usp=sharing


TAG Review

https://github.com/w3ctag/design-reviews/issues/219


Summary

CSS Selectors 4 will be introducing the matches-any pseudo-class :matches().


Motivation

The motivation for implementing :matches() is to eventually remove the need for the vendor-specific prefix to the :-webkit-any() selector, which is currently implemented in Chrome, and improve interoperability. Safari already implements :matches(), so implementing this in Chrome should further encourage Edge and Firefox to implement it also. Edge has not shipped any implementation of :matches() and Firefox, like Chrome, has a vendor-specific prefix to the selector (:-moz-any()).


Browsers Referenced

Browser

Version

Operating System

Chrome

62

Debian Linux

Firefox

57

Windows 10

Safari

11

macOS High Sierra

Edge

16

Windows 10



Risks

Interoperability and Compatibility

There should be low interoperability risk as Safari has already shipped this feature. Chrome also implements similar functionality through the selector :-webkit-any(), however without the capability of processing complex selectors as arguments. Firefox and Edge would then be further influenced to implement :matches().


The removal of :-webkit-any() will not occur during the implementation of :matches(). Use-counters will be added to both selectors to aid in the decision of removing :-webkit-any() in the future. :-webkit-any() has already been deprecated by Webkit.


There should be low compatibility risk when adding this feature as it has most of the required functionality implemented already by :-webkit-any() and only requires the additional implementation of complex selector lists.

Comparison between browsers and their implementations of some of these features can be found here.


Ergonomics

N/A.


Activation

It should not be challenging for developers to use this feature once it is implemented.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


Feature dashboard link

https://www.chromestatus.com/feature/5445716612743168


Requesting approval to ship?

No.


PhistucK

unread,
Feb 2, 2018, 9:00:03 AM2/2/18
to Victoria Su, blink-dev
The interoperability regarding complex selector is concerning - any word on that front?


PhistucK

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/9879fad2-46e0-45c0-a359-2416cf085173%40chromium.org.

Reply all
Reply to author
Forward
0 new messages