hasAttribute method

bool hasAttribute(
  1. String attributeName
)

Returns true if this element has an attribute named attributeName.

attributeName must not be null or empty.

Implementation

bool hasAttribute(String attributeName) {
  assert(attributeName.isNotEmpty);

  if (attributes == null) return false;

  attributeName = attributeName.toLowerCase();

  for (var attribute in attributes!) {
    if (attribute.name.toLowerCase() == attributeName) {
      return true;
    }
  }

  return false;
}