Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
7 changes: 6 additions & 1 deletion src/css/selectors/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2554,7 +2554,12 @@ impl NthSelectorData {
}

pub(crate) fn is_function_(&self) -> bool {
self.a != 0 || self.b != 1
match self.ty {
// No `:first-col` shorthand exists.
NthType::Col | NthType::LastCol => true,
NthType::OnlyChild | NthType::OnlyOfType => false,
_ => self.a != 0 || self.b != 1,
}
}

fn number_sign(num: i32) -> &'static str {
Expand Down
8 changes: 8 additions & 0 deletions test/js/bun/css/css.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5287,6 +5287,14 @@ describe("css tests", () => {
minify_test(":nth-last-col(-n+2) {width: 20px}", ":nth-last-col(-n+2){width:20px}");
minify_test(":nth-last-col(even) {width: 20px}", ":nth-last-col(2n){width:20px}");
minify_test(":nth-last-col(odd) {width: 20px}", ":nth-last-col(odd){width:20px}");
// `0n+1` has no `:first-col` shorthand, unlike `:nth-child(1)`.
minify_test(":nth-col(1) {width: 20px}", ":nth-col(1){width:20px}");
minify_test(":nth-col(0n+1) {width: 20px}", ":nth-col(1){width:20px}");
minify_test(":nth-last-col(1) {width: 20px}", ":nth-last-col(1){width:20px}");
minify_test(
":nth-col(1) {c: d} :nth-last-col(1) {e: f} .after {g: h}",
":nth-col(1){c:d}:nth-last-col(1){e:f}.after{g:h}",
);
minify_test(":nth-child(odd) {width: 20px}", ":nth-child(odd){width:20px}");
minify_test(":nth-child(2n) {width: 20px}", ":nth-child(2n){width:20px}");
minify_test(":nth-child(2n+1) {width: 20px}", ":nth-child(odd){width:20px}");
Expand Down
Loading