removeAttribute method

void removeAttribute(
  1. String name
)

Implementation

void removeAttribute(String name) {
  //
  // Loosely based on:
  // https://dom.spec.whatwg.org/#dom-element-removeattribute
  //

  if (!_isXml) {
    name = name.toLowerCase();

    if (name == 'style') {
      _style = null;
      return;
    }
  }

  _Attribute? previous;
  var current = _firstAttribute;
  while (current != null) {
    final next = current._next;
    if (current._localName == name) {
      if (previous == null) {
        _firstAttribute = next;
      } else {
        previous._next = next;
      }
      return;
    }
    previous = current;
    current = next;
  }
}