Former-commit-id: 9f1f09311813203910d5b323ba80712553ee2741 [formerly 0be00be1de305d786affc6bf0886aed9b20fbc51] [formerly 04597463117e94830b24b87faaaccf3d35284427 [formerly 3f2dc3f1c5]]
Former-commit-id: 8d26cc1d96faed73c7974ea7e5e78bf268af3ad9 [formerly a083ac8f68c90a636843c3565bd349657c0ec383]
Former-commit-id: ef10f3b3c388d65ceac40785b45dbac190a6cc99
29 lines
614 B
JavaScript
29 lines
614 B
JavaScript
export default function getRule (rules) {
|
|
for (let i = 0; i < rules.length; i++) {
|
|
rules[i] = rules[i].toLowerCase()
|
|
}
|
|
|
|
let result = null
|
|
let find = Array.prototype.find
|
|
|
|
find.call(document.styleSheets, styleSheet => {
|
|
result = find.call(styleSheet.cssRules, cssRule => {
|
|
let found = false
|
|
|
|
if (cssRule instanceof window.CSSStyleRule) {
|
|
for (let i = 0; i < rules.length; i++) {
|
|
if (cssRule.selectorText.toLowerCase() === rules[i]) {
|
|
found = true
|
|
}
|
|
}
|
|
}
|
|
|
|
return found
|
|
})
|
|
|
|
return result != null
|
|
})
|
|
|
|
return result
|
|
}
|