Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
add scripting variants
  • Loading branch information
lukewarlow authored and philipp-spiess committed Feb 26, 2025
commit 5c399b47d691d5fcbdf98cae5f107e4dcc0cb13f
Original file line number Diff line number Diff line change
Expand Up @@ -8449,6 +8449,8 @@ exports[`getVariants 1`] = `
"print",
"forced-colors",
"inverted-colors",
"noscript",
"scripting",
],
},
{
Expand Down Expand Up @@ -9184,5 +9186,19 @@ exports[`getVariants 1`] = `
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": false,
"name": "noscript",
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": false,
"name": "scripting",
"selectors": [Function],
"values": [],
},
]
`;
20 changes: 20 additions & 0 deletions packages/tailwindcss/src/variants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,26 @@ test('inverted-colors', async () => {
`)
})

test('noscript', async () => {
expect(await run(['noscript:flex'])).toMatchInlineSnapshot(`
"@media (scripting: none) {
.noscript\\:flex {
display: flex;
}
}"
`)
})

test('scripting', async () => {
expect(await run(['scripting:flex'])).toMatchInlineSnapshot(`
"@media (scripting: enabled) {
.scripting\\:flex {
display: flex;
}
}"
`)
})

test('nth', async () => {
expect(
await run([
Expand Down
3 changes: 3 additions & 0 deletions packages/tailwindcss/src/variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,9 @@ export function createVariants(theme: Theme): Variants {
staticVariant('inverted-colors', ['@media (inverted-colors: inverted)'])
}

staticVariant('noscript', ['@media (scripting: none)'])
staticVariant('scripting', ['@media (scripting: enabled)'])

return variants
}

Expand Down