W3cubDocs

/Dart 2

classes property

CssClassSet classes

The set of CSS classes applied to this element.

This set makes it easy to add, remove or toggle the classes applied to this element.

element.classes.add('selected');
element.classes.toggle('isOnline');
element.classes.remove('selected');

Implementation

CssClassSet get classes => new _ElementCssClassSet(this);
void classes= (Iterable<String> value)

Implementation

set classes(Iterable<String> value) {
  // TODO(sra): Do this without reading the classes in clear() and addAll(),
  // or writing the classes in clear().
  CssClassSet classSet = classes;
  classSet.clear();
  classSet.addAll(value);
}

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.5.0/dart-html/Element/classes.html