From 43b716e1c912b3df29bfcd8f5afed7eb74586cbd Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Thu, 19 Dec 2024 15:46:21 -0500 Subject: [PATCH 1/5] =?UTF-8?q?Don=E2=80=99t=20start=20an=20arbitrary=20pr?= =?UTF-8?q?operty=20when=20preceded=20by=20an=20escape?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/oxide/src/parser.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/crates/oxide/src/parser.rs b/crates/oxide/src/parser.rs index 281774261ad6..e89d9a10be15 100644 --- a/crates/oxide/src/parser.rs +++ b/crates/oxide/src/parser.rs @@ -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'\\' => { trace!("Arbitrary::Start\t"); self.arbitrary = Arbitrary::Brackets { start_idx: self.cursor.pos, @@ -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) { self.parse_arbitrary() } else if self.in_candidate { self.parse_continue() @@ -1634,4 +1634,15 @@ mod test { ] ); } + + #[test] + fn wip2() { + _please_trace(); + let candidates = run( + r"", + false, + ); + + assert_eq!(candidates, vec!["!code", "a"]); + } } From aa24e6e2370841991da37138d2feebb9ea492ac5 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Thu, 19 Dec 2024 15:50:23 -0500 Subject: [PATCH 2/5] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ecc63017d21..0435312a37a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 From 1d6aa73fa7ce4c9ae527848d663475e0e280228e Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 20 Dec 2024 06:35:57 -0500 Subject: [PATCH 3/5] Tweak test --- crates/oxide/src/parser.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/oxide/src/parser.rs b/crates/oxide/src/parser.rs index e89d9a10be15..e90ec486ae45 100644 --- a/crates/oxide/src/parser.rs +++ b/crates/oxide/src/parser.rs @@ -1639,7 +1639,10 @@ mod test { fn wip2() { _please_trace(); let candidates = run( - r"", + r#" + + \\[a\\]\\:block] + "#, false, ); From 6c5be397061a4c733228861de275e712a188a67d Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 20 Dec 2024 06:36:01 -0500 Subject: [PATCH 4/5] Update test name --- crates/oxide/src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/oxide/src/parser.rs b/crates/oxide/src/parser.rs index e90ec486ae45..3b4103bee82d 100644 --- a/crates/oxide/src/parser.rs +++ b/crates/oxide/src/parser.rs @@ -1636,7 +1636,7 @@ mod test { } #[test] - fn wip2() { + fn arbitrary_properties_are_not_picked_up_after_an_escape() { _please_trace(); let candidates = run( r#" From d7c2e15a8dab6f823ae1a369727a24f41b5be06d Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 20 Dec 2024 13:29:11 +0100 Subject: [PATCH 5/5] fix indentation --- crates/oxide/src/parser.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/oxide/src/parser.rs b/crates/oxide/src/parser.rs index 3b4103bee82d..1c8fdf75c0f2 100644 --- a/crates/oxide/src/parser.rs +++ b/crates/oxide/src/parser.rs @@ -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) { self.parse_arbitrary() } else if self.in_candidate { self.parse_continue()