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:
- Selecting elements - querying for DOM elements.
- Modifying elements - modifying attributes of selected elements.
- Joining data - joining data to selected elements for visualization.
- Handling events - declaring event listeners for interaction.
- Control flow - iterating over selected elements.
- Local variables - attaching state to elements.
- Namespaces - dealing with XML namespaces.
Classes
- Local Local variables
- D4 locals allow you to define local state independent of data.
- Selection
Extensions
- SelectionAppend on Selection
- SelectionAttr on Selection
- SelectionCall on Selection Control flow
- SelectionClassed on Selection
- SelectionClone on Selection
- 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
- SelectionInsert on Selection
- SelectionIterator on Selection Control flow
- SelectionJoin on Selection Joining data
- SelectionLower on Selection
- SelectionMerge on Selection Joining data
- SelectionNode on Selection Control flow
- SelectionNodes on Selection Control flow
- SelectionOn on Selection Handling events
- SelectionOrder on Selection
- SelectionProperty on Selection
-
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’schecked
boolean. Use this extension to get or set these properties. - SelectionRaise on Selection
- SelectionRemove on Selection
- 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
- SelectionStyle on Selection
- SelectionText on Selection
Properties
-
namespaces
→ Map<
String, String> Namespaces -
The map of registered namespace prefixes. The initial value is:
final
Functions
-
create(
String name) → Selection - 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?> ?]) -
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< Selecting elementsElement?> ?]) -
Given the specified selector, returns a function which returns true if
this
element matches the specified selector. -
namespace(
String name) → Union2< NamespacesMap< String, String> , String> - Qualifies the specified name, which may or may not have a namespace prefix.
-
select(
[Union2< Selecting elementsString, Element> ? selector]) → Selection - Selects the first element that matches the specified selector string.
-
selectAll(
[Union3< Selecting elementsString, Iterable< ? selector]) → SelectionElement?> , Object> - 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< Selecting elementsElement?> ?]) -
Given the specified selector, returns a function which returns the first
descendant of
this
element that matches the specified selector. -
selectorAll(
[String? selector]) → List< Selecting elementsElement?> Function(Element, [JSAny?, int?, List<Element?> ?]) -
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.