getAttribute method
Implementation
String? getAttribute(Pointer selfPtr, String key) {
Node? target = getBindingObject<Node>(selfPtr);
if (target == null) return null;
if (target is Element) {
// Only element has attributes.
return target.getAttribute(key);
} else if (target is TextNode && (key == 'data' || key == 'nodeValue')) {
// @TODO: property is not attribute.
return target.data;
} else {
return null;
}
}