attrGet method
Returns the current value of the specified attribute for the first (non-null) element in the selection.
selection.attrGet("color"); // "red"
This is generally useful only if you know that the selection contains exactly one element.
The specified name may have a namespace prefix, such as xlink:href
to
specify the href
attribute in the XLink namespace. See
namespaces for the map of supported
namespaces; additional namespaces can be registered by adding to the map.
Implementation
String? attrGet(String name) {
var fullname = g.namespace(name);
var node = this.node();
return fullname.split(
(fullname) => node?.getAttributeNS(fullname["space"], fullname["local"]!),
(name) => node?.getAttribute(name),
);
}