Skip to content

Commit 623e6fc

Browse files
committed
fix bug undefined selectors
- fix bug undefined selectors FullHuman#13
1 parent 8a6b05e commit 623e6fc

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

lib/purgecss.es.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/purgecss.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,15 @@ class Purgecss {
168168
if (selector.type === 'selector') {
169169
for (let nodeSelector of selector.nodes) {
170170
const { type, value } = nodeSelector
171-
if (SELECTOR_STANDARD_TYPES.includes(type)) {
171+
if (
172+
SELECTOR_STANDARD_TYPES.includes(type) &&
173+
typeof value !== 'undefined'
174+
) {
172175
selectorsInRule.push(value)
173-
} else if (type === 'attribute') {
176+
} else if (
177+
type === 'attribute' &&
178+
typeof nodeSelector.raws.unquoted !== 'undefined'
179+
) {
174180
selectorsInRule.push(nodeSelector.raws.unquoted)
175181
}
176182
}

0 commit comments

Comments
 (0)