aboutsummaryrefslogtreecommitdiffstats
path: root/components/selectors/parser.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2022-09-06 17:00:33 +0000
committerMartin Robinson <mrobinson@igalia.com>2023-11-03 08:59:49 +0100
commit9f6341b83a088e7062f7915e113acd2bd512162e (patch)
treeb4eef8a9b55680734f01263d8417fde756150022 /components/selectors/parser.rs
parentab36c8a39bba7e21e77d93da94ef5a21bfe3e122 (diff)
downloadservo-9f6341b83a088e7062f7915e113acd2bd512162e.tar.gz
servo-9f6341b83a088e7062f7915e113acd2bd512162e.zip
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
Diffstat (limited to 'components/selectors/parser.rs')
-rw-r--r--components/selectors/parser.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/components/selectors/parser.rs b/components/selectors/parser.rs
index 2fc5ad02d39..ccb4b943226 100644
--- a/components/selectors/parser.rs
+++ b/components/selectors/parser.rs
@@ -276,6 +276,11 @@ pub trait Parser<'i> {
false
}
+ /// Whether to allow forgiving selector-list parsing.
+ fn allow_forgiving_selectors(&self) -> bool {
+ true
+ }
+
/// Parses non-tree-structural pseudo-classes. Tree structural pseudo-classes,
/// like `:first-child`, are built into this library.
///
@@ -400,7 +405,11 @@ impl<Impl: SelectorImpl> SelectorList<Impl> {
Ok(selector) => values.push(selector),
Err(err) => match recovery {
ParseErrorRecovery::DiscardList => return Err(err),
- ParseErrorRecovery::IgnoreInvalidSelector => {},
+ ParseErrorRecovery::IgnoreInvalidSelector => {
+ if !parser.allow_forgiving_selectors() {
+ return Err(err);
+ }
+ },
},
}