getElementAttributeRegExp function

String? getElementAttributeRegExp(
  1. Element element,
  2. RegExp key
)

Returns element attribute with RegExp key.

Implementation

String? getElementAttributeRegExp(Element element, RegExp key) {
  var attrs = element.attributes;

  for (var k in attrs.keys) {
    if (key.hasMatch(k)) {
      return attrs[k];
    }
  }

  return null;
}