Skip to content

Commit

Permalink
adds support for * element selector
Browse files Browse the repository at this point in the history
  • Loading branch information
jonatanpedersen committed Feb 3, 2017
1 parent 235c8ad commit 8364f7e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function cssBingo (cssCode, htmlCode) {
switch (rule.type) {
case 'rule':
rule.selectors = rule.selectors.filter(selector => {
if (/^[\.#]?[^:>\s+~ ]+$/.test(selector)) {
if (/^[\.#]?[^:>\*\s+~ ]+$/.test(selector)) {
return knownSelectors.has(selector);
} else {
return true;
Expand Down
6 changes: 6 additions & 0 deletions test/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,11 @@
"css": ".heading-1{color:#000;}",
"html": "<html><body><h1 data-class=\"heading-1\">Foo</body></html>",
"expected": ".heading-1{color:#000;}"
},
{
"description": "keeps * element selector rules",
"css": "*{color:#000;}",
"html": "<html><body><h1 data-class=\"heading-1\">Foo</body></html>",
"expected": "*{color:#000;}"
}
]

0 comments on commit 8364f7e

Please sign in to comment.