Skip to content

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 👍

}

#[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

#[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? 🤔

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.

4 participants