Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export function parse (value, root, parent, rule, rules, rulesets, pseudo, point
case 0: case 125: scanning = 0
// ;
case 59 + offset: if (ampersand == -1) characters = replace(characters, /\f/g, '')
if (property > 0 && (strlen(characters) - length || (variable === 0 && previous === 47)))
if (property > 0 && (strlen(characters) - length || variable === 0))
append(property > 32 ? declaration(characters + ';', rule, parent, length - 1, declarations) : declaration(replace(characters, ' ', '') + ';', rule, parent, length - 2, declarations), declarations)
break
// @ ;
Expand Down
27 changes: 27 additions & 0 deletions test/Parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,33 @@ describe('Parser', () => {
--tw-brightness:/*!*/;
`)
).to.equal(`.user{--tw-brightness:;}`)

expect(
stylis(`
--x:;
--y: ;
`)
).to.equal(`.user{--x:;--y:;}`)

expect(
serialize(compile(`@keyframes foo{from{--x:red;}to{--x:;}}`), stringify)
).to.equal(`@keyframes foo{from{--x:red;}to{--x:;}}`)

expect(
serialize(compile(`@keyframes foo{from{--x:red;}to{--x: ;}}`), stringify)
).to.equal(`@keyframes foo{from{--x:red;}to{--x:;}}`)

expect(
stylis(`
.box { transform: translateX(20px) var(--extra-transform); }
.on { --extra-transform: scale(1.2); }
.off { --extra-transform: ; }
`)
).to.equal([
`.user .box{transform:translateX(20px) var(--extra-transform);}`,
`.user .on{--extra-transform:scale(1.2);}`,
`.user .off{--extra-transform:;}`
].join(''))
})

test('& in first selector within a comma-separated list', () => {
Expand Down
Loading