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

fix(stylehacks): doesn't throw error on [attr] selector #711

Merged
merged 1 commit into from Feb 14, 2019
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
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);
});