style: Disallow forgiving selector-parsing in @supports

As per spec, see https://github.com/w3c/csswg-drafts/issues/7280

Differential Revision: https://phabricator.services.mozilla.com/D156468
This commit is contained in:
Emilio Cobos Álvarez 2022-09-06 17:00:33 +00:00 committed by Martin Robinson
parent ab36c8a39b
commit 9f6341b83a
6 changed files with 25 additions and 23 deletions

View file

@ -320,6 +320,11 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
function.eq_ignore_ascii_case("-moz-any")
}
#[inline]
fn allow_forgiving_selectors(&self) -> bool {
!self.for_supports_rule
}
fn parse_non_ts_pseudo_class(
&self,
location: SourceLocation,
@ -373,7 +378,8 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
location: SourceLocation,
name: CowRcStr<'i>,
) -> Result<PseudoElement, ParseError<'i>> {
if let Some(pseudo) = PseudoElement::from_slice(&name) {
let allow_unkown_webkit = !self.for_supports_rule;
if let Some(pseudo) = PseudoElement::from_slice(&name, allow_unkown_webkit) {
if self.is_pseudo_element_enabled(&pseudo) {
return Ok(pseudo);
}