d4_selection library

Transform the DOM by selecting elements and joining to data.

Selections allow powerful data-driven transformation of the document object model (DOM): set attributes, styles, properties, HTML or text content, and more. Using the data join’s enter and exit selections, you can also add or remove elements to correspond to data.

See one of:

Classes

Local Local variables
D4 locals allow you to define local state independent of data.
Selection

Extensions

SelectionAppend on Selection Modifying elements
SelectionAttr on Selection Modifying elements
SelectionCall on Selection Control flow
SelectionClassed on Selection Modifying elements
SelectionClone on Selection Modifying elements
SelectionData on Selection Joining data
SelectionDatum on Selection Joining data
SelectionDispatch on Selection Handling events
SelectionEach on Selection Control flow
SelectionEmpty on Selection Control flow
SelectionEnter on Selection Joining data
SelectionExit on Selection Joining data
SelectionFilter on Selection Selecting elements
SelectionHtml on Selection Modifying elements
SelectionInsert on Selection Modifying elements
SelectionIterator on Selection Control flow
SelectionJoin on Selection Joining data
SelectionLower on Selection Modifying elements
SelectionMerge on Selection Joining data
SelectionNode on Selection Control flow
SelectionNodes on Selection Control flow
SelectionOn on Selection Handling events
SelectionOrder on Selection Modifying elements
SelectionProperty on Selection Modifying elements
Some HTML elements have special properties that are not addressable using attributes or styles, such as a form field’s text value and a checkbox’s checked boolean. Use this extension to get or set these properties.
SelectionRaise on Selection Modifying elements
SelectionRemove on Selection Modifying elements
SelectionSelect on Selection Selecting elements
SelectionSelectAll on Selection Selecting elements
SelectionSelectChild on Selection Selecting elements
SelectionSelectChildren on Selection Selecting elements
SelectionSelection on Selection Selecting elements
SelectionSize on Selection Control flow
SelectionSort on Selection Modifying elements
SelectionStyle on Selection Modifying elements
SelectionText on Selection Modifying elements

Properties

namespaces Map<String, String> Namespaces
The map of registered namespace prefixes. The initial value is:
final

Functions

create(String name) Selection Modifying elements
Given the specified element name, returns a single-element selection containing a detached element of the given name in the current document.
creator(String name) → Element Function(Element, [JSAny?, int?, List<Element?>?]) Modifying elements
Given the specified element name, returns a function which creates an element of the given name, assuming that thisArg is the parent element.
matcher(String selector) bool Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns true if this element matches the specified selector.
namespace(String name) → Union2<Map<String, String>, String> Namespaces
Qualifies the specified name, which may or may not have a namespace prefix.
select([Union2<String, Element>? selector]) Selection Selecting elements
Selects the first element that matches the specified selector string.
selectAll([Union3<String, Iterable<Element?>, Object>? selector]) Selection Selecting elements
Selects all elements that match the specified selector string.
selection() Selection Selecting elements
Selects the root element, document.documentElement.]
selector([String? selector]) → Element? Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns the first descendant of this element that matches the specified selector.
selectorAll([String? selector]) List<Element?> Function(Element, [JSAny?, int?, List<Element?>?]) Selecting elements
Given the specified selector, returns a function which returns all descendants of this element that match the specified selector.
style(Element? node, String name) String? Selecting elements
Returns the value of the style property with the specified name for the specified node.
window(EventTarget node) → Window Selecting elements
Returns the owner window for the specified node.