In fact I would suggest that this whole function could be replaced with:

```
function containsAttr(node, attributeName) {
  var attr, attrs = node.attributes, length = attrs && attrs.length;
  if ( length ) {
    for (var j = 0; j < length; j++) {
      attr = attrs[j];
      if (attr.specified && directiveNormalize(attr.name) == attributeName) {
        return true;
      }
    }
  }
  return false;
}
```

But I might be missing something :-)