1
1
mirror of https://github.com/primer/css.git synced 2025-01-01 18:53:34 +03:00

Better matching

This commit is contained in:
Jon Rohan 2017-07-25 15:11:27 -07:00
parent c07e69ae91
commit 08afa167df

View File

@ -9,7 +9,7 @@ const classRegex = /class="([^"]+)"/ig
function uniqueSelectors(s) {
return s.filter(s => {
// remove any selectors with hover states
return !s.includes(":") && !s.includes(".")
return s.match(/^\.[a-z\-_\s\.]+$/ig)
}).map(s => {
// split multi-selectors into last class used .foo .bar .baz
return s.split(" ").pop()