parseCSSStylesheet method
dynamic
parseCSSStylesheet(
- dynamic node
Implementation
parseCSSStylesheet(node) {
if (node.sheet == null || node.sheet.cssRules == null || node.sheet.cssRules.length == 0) {
return;
}
for (var i = 0; i < node.sheet.cssRules.length; i++) {
var stylesheet = node.sheet.cssRules[i];
if (stylesheet.type != 1) continue;
RegExp reg = RegExp(r",", multiLine: true);
var selectorList = stylesheet.selectorText.split(reg).map((i) => i.trim()).toList();
// var selectorList = stylesheet.selectorText
// .split( /,/gm )
// .filter( Boolean )
// .map( i => i.trim() );
for (var j = 0; j < selectorList.length; j++) {
var sj = selectorList[j];
if (stylesheets[sj] == null) {
stylesheets[sj] = {};
}
stylesheets[sj].addAll(stylesheet.style);
// stylesheets[ selectorList[ j ] ] = Object.assign(
// stylesheets[ selectorList[ j ] ] || {},
// stylesheet.style
// );
}
}
}