-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don’t detect arbitrary properties when preceded by an escape #15456
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good but the test needs a proper title 👍
crates/oxide/src/parser.rs
Outdated
@@ -1634,4 +1634,15 @@ mod test { | |||
] | |||
); | |||
} | |||
|
|||
#[test] | |||
fn wip2() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Title needs updating 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah lol good call
crates/oxide/src/parser.rs
Outdated
@@ -755,7 +755,7 @@ impl<'a> Extractor<'a> { | |||
|
|||
#[inline(always)] | |||
fn parse_char(&mut self) -> ParseAction<'a> { | |||
if !matches!(self.arbitrary, Arbitrary::None) { | |||
if !matches!(self.arbitrary, Arbitrary::None) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what happened here? 🤔
@@ -595,7 +595,7 @@ impl<'a> Extractor<'a> { | |||
fn parse_start(&mut self) -> ParseAction<'a> { | |||
match self.cursor.curr { | |||
// Enter arbitrary property mode | |||
b'[' => { | |||
b'[' if self.cursor.prev != b'\\' => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Easy 😍
This is a targeted bug fix uncovered by the v4 docs.
Given this code:
<!-- [!code word:group-has-\\[a\\]\\:block] -->
We'd pick up
[a\\]\\:block]
as a candidate which would then make it far enough to get output to CSS and throw an error. This makes sure we don't try to start an arbitrary property if the preceding character is a\
cc @RobinMalfait this look okay?