Skip to content

Commit

Permalink
Stop parsing @supports rules before Delimeter::Bang
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Jun 5, 2017
1 parent b584944 commit 4ad3224
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions components/style/stylesheets/supports_rule.rs
Expand Up @@ -4,7 +4,7 @@

//! [@supports rules](https://drafts.csswg.org/css-conditional-3/#at-supports)

use cssparser::{parse_important, Parser, SourceLocation, Token};
use cssparser::{Delimiter, parse_important, Parser, SourceLocation, Token};
use parser::ParserContext;
use properties::{PropertyId, PropertyDeclaration, SourcePropertyDeclaration};
use shared_lock::{DeepCloneWithLock, Locked, SharedRwLock, SharedRwLockReadGuard, ToCssWithGuard};
Expand Down Expand Up @@ -263,7 +263,10 @@ impl Declaration {
let mut input = Parser::new(&self.val);
let context = ParserContext::new_with_rule_type(cx, Some(CssRuleType::Style));
let mut declarations = SourcePropertyDeclaration::new();
let res = PropertyDeclaration::parse_into(&mut declarations, id, &context, &mut input);
let res = input.parse_until_before(Delimiter::Bang, |input| {
PropertyDeclaration::parse_into(&mut declarations, id, &context, input)
.map_err(|_| ())
});
let _ = input.try(parse_important);
res.is_ok() && input.is_exhausted()
}
Expand Down

0 comments on commit 4ad3224

Please sign in to comment.