Skip to content

Commit

Permalink
fix(stylehacks): doesn't throw error on [attr] selector (#711)
Browse files Browse the repository at this point in the history
  • Loading branch information
evilebottnawi committed Feb 14, 2019
1 parent b165ee6 commit a4a43c3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
27 changes: 27 additions & 0 deletions packages/stylehacks/src/__tests__/starHtml.js
Expand Up @@ -16,3 +16,30 @@ test(
'',
{target: 'ie6', unaffected: 'ie7'}
);

test(
'should not throw error',
processCSS,
'.class { color: red }',
'.class { color: red }',
{target: 'ie6', unaffected: 'ie7'},
0
);

test(
'should not throw error #2',
processCSS,
'* { color: red }',
'* { color: red }',
{target: 'ie6', unaffected: 'ie7'},
0
);

test(
'should not throw error #3',
processCSS,
'[hidden] { color: red }',
'[hidden] { color: red }',
{target: 'ie6', unaffected: 'ie7'},
0
);
2 changes: 1 addition & 1 deletion packages/stylehacks/src/exists.js
@@ -1,5 +1,5 @@
export default function exists (selector, index, value) {
const node = selector.at(index);

return node && node.value.toLowerCase() === value;
return node && node.value && node.value.toLowerCase() === value;
}
1 change: 1 addition & 0 deletions packages/stylehacks/src/plugins/starHtml.js
Expand Up @@ -30,5 +30,6 @@ export default plugin([IE_5_5, IE_6], [RULE], function (rule) {
if (isMixin(rule)) {
return;
}

parser(analyse(this, rule)).processSync(rule.selector);
});

0 comments on commit a4a43c3

Please sign in to comment.