Open tunnckoCore opened 7 years ago
It would be just that
hasAttribute (key) {
return this.hasAttributeNS(null, key)
}
hasAttributeNS (namespaceURI, key) {
return (
this.attributes.hasOwnProperty(key) &&
this.attributes[key].namespaceURI === namespaceURI
)
}
if setting attribute is correctly implemented. The interesting thing about this.attribtues
is that it's map, where we have both indices and key names. So if we have this html
<div id="foo" bar="qux">hello</div>
then el.attributes[1]
will be AttributeNode, but also it can be accessed with el.attributes.bar
Definitely open to a PR for this! I'm curious how small it could be.
They are pretty small addition, which can easily be implemented.