Skip to content
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

Merged
merged 5 commits into from
Dec 20, 2024

Conversation

thecrypticace
Copy link
Contributor

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?

@thecrypticace thecrypticace requested a review from a team as a code owner December 19, 2024 20:49
@thecrypticace thecrypticace changed the title Don’t start an arbitrary property when preceded by an escape Don’t detect arbitrary properties when preceded by an escape Dec 19, 2024
Copy link
Member

@philipp-spiess philipp-spiess left a 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 👍

@@ -1634,4 +1634,15 @@ mod test {
]
);
}

#[test]
fn wip2() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Title needs updating 😅

Copy link
Contributor Author

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

@@ -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) {
Copy link
Member

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'\\' => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy 😍

@RobinMalfait RobinMalfait merged commit 00ccbdc into next Dec 20, 2024
5 checks passed
@RobinMalfait RobinMalfait deleted the fix/v4-arbitrary-property-after-escape branch December 20, 2024 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants