From 8364f7e5b6c3d780088c31f538a39e8f9d22ad92 Mon Sep 17 00:00:00 2001 From: Jonatan Pedersen Date: Fri, 3 Feb 2017 14:18:43 +0100 Subject: [PATCH] adds support for * element selector --- index.js | 2 +- test/tests.json | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 2d1f4aa..ed95b9f 100644 --- a/index.js +++ b/index.js @@ -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; diff --git a/test/tests.json b/test/tests.json index af18ede..caabc9f 100644 --- a/test/tests.json +++ b/test/tests.json @@ -154,5 +154,11 @@ "css": ".heading-1{color:#000;}", "html": "

Foo", "expected": ".heading-1{color:#000;}" + }, + { + "description": "keeps * element selector rules", + "css": "*{color:#000;}", + "html": "

Foo", + "expected": "*{color:#000;}" } ]