diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-08-12 04:26:07 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2021-02-26 16:44:05 +0100 |
commit | 9ce200a92492882082b4a5b8da05cdbe5ada2d37 (patch) | |
tree | 283818bb7698c333b92ac24fdf770bcf65e4ed85 /components/selectors/parser.rs | |
parent | 919ff06445f878bdfa2791e7cc99119a08d5637f (diff) | |
download | servo-9ce200a92492882082b4a5b8da05cdbe5ada2d37.tar.gz servo-9ce200a92492882082b4a5b8da05cdbe5ada2d37.zip |
style: Implement :-moz-any() as an alias of :is().
This is strictly better and more flexible, but can change specificity so
have a pref in case it causes trouble. I doubt it will though, the
specificity rules of :is() make more sense, and my gut feeling is that
:-moz-any is not very used on the wild.
Make it early-beta-or-earlier for now to minimize risk, once this is on
nightly for a bit we can enable it everywhere.
Differential Revision: https://phabricator.services.mozilla.com/D86696
Diffstat (limited to 'components/selectors/parser.rs')
-rw-r--r-- | components/selectors/parser.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs index 9980bdeeb60..8f87c785f3e 100644 --- a/components/selectors/parser.rs +++ b/components/selectors/parser.rs @@ -254,6 +254,11 @@ pub trait Parser<'i> { false } + /// Whether the given function name is an alias for the `:is()` function. + fn is_is_alias(&self, _name: &str) -> bool { + false + } + /// Whether to parse the `:host` pseudo-class. fn parse_host(&self) -> bool { false @@ -2302,6 +2307,10 @@ where _ => {} } + if parser.parse_is_and_where() && parser.is_is_alias(&name) { + return parse_is_or_where(parser, input, state, Component::Is); + } + if !state.allows_custom_functional_pseudo_classes() { return Err(input.new_custom_error(SelectorParseErrorKind::InvalidState)); } |