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
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ function pickAndClearDeclarations(

function atruleNames(defaults, custom = '') {
let names = defaults.concat(custom)
let list = {}
let list = Object.create(null)
for (let name of names) {
list[name.replace(/^@/, '')] = true
}
Expand Down
11 changes: 11 additions & 0 deletions index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,17 @@ test('cleans rules after unwrap', () => {
run('a { b .one {} b .two {} }', 'a b .one {} a b .two {}')
})

test('does not bubble inherited object property names', () => {
run('a { @constructor { color: red } }', 'a { @constructor { color: red } }')
run('a { @toString { color: red } }', 'a { @toString { color: red } }')
})

test('bubbles explicitly configured inherited object property names', () => {
run('a { @constructor { color: red } }', '@constructor { a { color: red } }', {
bubble: ['constructor']
})
})

test('preserve empty rules if preserveEmpty is set to true', () => {
run('a { b .one {} b .two {} }', 'a { } a b .one {} a b .two {}', {
preserveEmpty: true
Expand Down
Loading