datumGet method
Returns the bound datum for the first (non-null) element in the selection.
This is generally useful only if you know the selection contains exactly one element.
This method is useful for accessing HTML5 custom data attributes. For example, given the following elements:
<ul id="list">
<li data-username="shawnbot">Shawn Allen</li>
<li data-username="mbostock">Mike Bostock</li>
</ul>
You can expose the custom data attributes by setting each element’s data as the built-in dataset property:
selection.datumSet((Element thisArg, JSAny? d, int i, List<Element?> nodes) {
return (thisArg as HTMLElement).dataset as JSAny?;
}.u21);
Implementation
JSAny? datumGet() {
return (node() as JSObject?)?["__data__"];
}