getElementAllCssRule function

List<CssRule> getElementAllCssRule(
  1. Element element
)

Returns a list of CssRule associated with element.

Implementation

List<CssRule> getElementAllCssRule(Element element) {
  var tag = element.tagName.toLowerCase();

  var patterns = [tag, ...element.classes.map((c) => r'\.' + c)];

  var regExp = RegExp(r'^(?:' + patterns.join('|') + r')$',
      multiLine: false, caseSensitive: false);

  var rules = selectCssRuleWithSelector(regExp);

  return rules;
}