attributeMatches method

TagQuery attributeMatches(
  1. String attr,
  2. RegExp pattern
)

Require that matched nodes have attribute attr with a value matching pattern.

Implementation

TagQuery attributeMatches(String attr, RegExp pattern) {
	// require attribute
	hasAttribute(attr);
	// and require value ~= pattern
	return where((n) => pattern.hasMatch(n.attributes[attr]!));
}