style: Don't remain in an invalid state when encountering an at-rule in the wrong place.

Currently, attempting to parse an at-rule that is out of place, such as
an @import rule after a regular style rule, will cause the parser state
to be set to Invalid.  This will cause any following at-rule to be
rejected until we encounter a regular style rule, at which point we'll
go back to the Body state.  There's nothing in the CSS specs about
needing to reject all following at-rules (or, as the comment above
Invalid says, ignoring the entire rest of the style sheet).
This commit is contained in:
Cameron McCormack 2017-07-29 15:05:58 +08:00
parent 6b320eaad3
commit 9c0ce7847f
3 changed files with 31 additions and 20 deletions

View file

@ -337,6 +337,7 @@ impl Stylesheet {
loader: stylesheet_loader,
context: context,
state: State::Start,
had_hierarchy_error: false,
namespaces: Some(namespaces),
};