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

Quick fix for incorrect arbitrary properties when using URLs #7252

Merged
merged 2 commits into from Jan 28, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Fix `@apply` order regression (in `addComponents`, `addUtilities`, ...) ([#7232](https://github.com/tailwindlabs/tailwindcss/pull/7232))
- Quick fix for incorrect arbitrary properties when using URLs ([#7252](https://github.com/tailwindlabs/tailwindcss/pull/7252))

## [3.0.17] - 2022-01-26

Expand Down
3 changes: 2 additions & 1 deletion src/lib/generateRules.js
Expand Up @@ -262,7 +262,8 @@ function parseRules(rule, cache, options = {}) {
const IS_VALID_PROPERTY_NAME = /^[a-z_-]/

function isValidPropName(name) {
return IS_VALID_PROPERTY_NAME.test(name)
// TODO: properly fix this!
return IS_VALID_PROPERTY_NAME.test(name) && !name.startsWith('http')
}

function isParsableCssValue(property, value) {
Expand Down
15 changes: 15 additions & 0 deletions tests/arbitrary-properties.test.js
Expand Up @@ -347,3 +347,18 @@ it('should be possible to read theme values in arbitrary properties (with quotes
`)
})
})

it('should not generate invalid CSS', () => {
let config = {
content: [
{
raw: html`<div class="[https://en.wikipedia.org/wiki]"></div>`,
},
],
corePlugins: { preflight: false },
}

return run('@tailwind utilities', config).then((result) => {
return expect(result.css).toMatchFormattedCss(css``)
})
})