readClasses method

Set<String> readClasses()

Read the class names from the Element class property, and put them into a set (duplicates are discarded). This is intended to be overridden by specific implementations.

Implementation

Set<String> readClasses() {
  var classname = _element.attributes['class'];
  if (classname is AnimatedString) {
    classname = (classname as AnimatedString).baseVal;
  }

  Set<String> s = new LinkedHashSet<String>();
  if (classname == null) {
    return s;
  }
  for (String name in classname.split(' ')) {
    String trimmed = name.trim();
    if (!trimmed.isEmpty) {
      s.add(trimmed);
    }
  }
  return s;
}