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
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Use the correct property value for `place-content-between`, `place-content-around`, and `place-content-evenly` utilities ([#15440](https://github.com/tailwindlabs/tailwindcss/pull/15440))
- Don’t detect arbitrary properties when preceded by an escape ([#15456](https://github.com/tailwindlabs/tailwindcss/pull/15456))

### Changed

Expand Down
15 changes: 13 additions & 2 deletions crates/oxide/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 😍

trace!("Arbitrary::Start\t");
self.arbitrary = Arbitrary::Brackets {
start_idx: self.cursor.pos,
Expand Down Expand Up @@ -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? 🤔

self.parse_arbitrary()
} else if self.in_candidate {
self.parse_continue()
Expand Down Expand Up @@ -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

_please_trace();
let candidates = run(
r"<!-- [!code word:group-has-\\[a\\]\\:block] -->",
false,
);

assert_eq!(candidates, vec!["!code", "a"]);
}
}