Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Treat starting single quote as verbatim text in Slim ([#17085](https://github.com/tailwindlabs/tailwindcss/pull/17085))
- Ensure `.node` and `.wasm` files are not scanned for utilities ([#17123](https://github.com/tailwindlabs/tailwindcss/pull/17123))
- Improve performance when scanning `JSON` files ([#17125](https://github.com/tailwindlabs/tailwindcss/pull/17125))
- Don't create invalid CSS when encountering a link wrapped in square brackets ([#17129](https://github.com/tailwindlabs/tailwindcss/pull/17129))

## [4.0.12] - 2025-03-07

Expand Down
10 changes: 10 additions & 0 deletions crates/oxide/src/extractor/arbitrary_property_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ impl Machine for ArbitraryPropertyMachine<ParsingValueState> {
#[inline]
fn next(&mut self, cursor: &mut cursor::Cursor<'_>) -> MachineState {
let len = cursor.input.len();
let start_of_value_pos = cursor.pos;
while cursor.pos < len {
match cursor.curr.into() {
Class::Escape => match cursor.next.into() {
Expand Down Expand Up @@ -222,6 +223,9 @@ impl Machine for ArbitraryPropertyMachine<ParsingValueState> {
// Any kind of whitespace is not allowed
Class::Whitespace => return self.restart(),

// URLs are not allowed
Class::Slash if start_of_value_pos == cursor.pos => return self.restart(),

// Everything else is valid
_ => cursor.advance(),
};
Expand Down Expand Up @@ -278,6 +282,9 @@ enum Class {
#[bytes(b':')]
Colon,

#[bytes(b'/')]
Slash,

#[bytes(b' ', b'\t', b'\n', b'\r', b'\x0C')]
Whitespace,

Expand Down Expand Up @@ -341,6 +348,9 @@ mod tests {
("[:red]", vec![]),
// Empty brackets are not allowed
("[]", vec![]),
// URLs
("[http://example.com]", vec![]),
("[https://example.com]", vec![]),
// Missing colon in more complex example
(r#"[CssClass("gap-y-4")]"#, vec![]),
// Brackets must be balanced
Expand Down