hasAttributeWhere method

bool hasAttributeWhere(
  1. String attributeName,
  2. String attributeValue
)

Returns true if this element has an attribute named attributeName and a value of attributeValue.

attributeName must not be null or empty.

Implementation

bool hasAttributeWhere(String attributeName, String attributeValue) {
  assert(attributeName.isNotEmpty);

  if (attributes == null) return false;

  attributeName = attributeName.toLowerCase();

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

  return false;
}