Selection class
- Mixed-in types
-
- Iterable<
Element?>
- Iterable<
- Available extensions
- SelectionAppend
- SelectionAttr
- SelectionCall
- SelectionClassed
- SelectionClone
- SelectionData
- SelectionDatum
- SelectionDispatch
- SelectionEach
- SelectionEmpty
- SelectionEnter
- SelectionExit
- SelectionFilter
- SelectionHtml
- SelectionInsert
- SelectionIterator
- SelectionJoin
- SelectionLower
- SelectionMerge
- SelectionNode
- SelectionNodes
- SelectionOn
- SelectionOrder
- SelectionProperty
- SelectionRaise
- SelectionRemove
- SelectionSelect
- SelectionSelectAll
- SelectionSelectChild
- SelectionSelectChildren
- SelectionSelection
- SelectionSize
- SelectionSort
- SelectionStyle
- SelectionText
Properties
- first → Element?
-
The first element.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
Element?> -
A new
Iterator
that allows iterating the elements of thisIterable
.no setteroverride -
iterator
→ Iterator<
Element> -
Available on Selection, provided by the SelectionIterator extension
Returns an iterator over the selected (non-null) elements.no setter - last → Element?
-
The last element.
no setterinherited
- length → int
-
The number of elements in this Iterable.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → Element?
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
Methods
-
any(
bool test(Element? element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
append(
Union2< EachCallback< type) → SelectionElement> , String> -
Available on Selection, provided by the SelectionAppend extension
If the specified type is a string, appends a new element of this type (tag name) as the last child of each selected element, or before the next following sibling in the update selection if this is an enter selection. -
attrGet(
String name) → String? -
Available on Selection, provided by the SelectionAttr extension
Returns the current value of the specified attribute for the first (non-null) element in the selection. -
attrSet(
String name, Union2< EachCallback< ? value) → SelectionString?> , String> -
Available on Selection, provided by the SelectionAttr extension
Sets the attribute with the specified name to the specified value on the selected elements and returns this selection. -
call(
void function(Selection, [List< Object?> ?]), [List<Object?> ? arguments]) → Selection -
Available on Selection, provided by the SelectionCall extension
Invokes the specified function exactly once, passing in this selection along with any optional arguments. Returns this selection. -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
R
instances.inherited -
classedIs(
String classes) → bool -
Available on Selection, provided by the SelectionClassed extension
Returns true if and only if the first (non-null) selected element has the specified classes. -
classedSet(
String names, Union2< EachCallback< value) → Selectionbool> , bool> -
Available on Selection, provided by the SelectionClassed extension
Assigns or unassigns the specified CSS class names on the selected elements by setting theclass
attribute or modifying theclassList
property and returns this selection. -
clone(
bool deep) → Selection -
Available on Selection, provided by the SelectionClone extension
Inserts clones of the selected elements immediately following the selected elements and returns a selection of the newly added clones. -
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element
.inherited -
dataBind(
Union2< EachCallback< data, [String key(Element, JSAny?, int, Union2<Iterable< , Iterable<JSAny?> >JSAny?> >List< )?]) → SelectionElement?> , List<JSAny?> > -
Available on Selection, provided by the SelectionData extension
Binds the specified list of data with the selected elements, returning a new selection that represents the update selection: the elements successfully bound to data. -
dataGet(
) → List< JSAny?> -
Available on Selection, provided by the SelectionData extension
Returns the list of data for the selected elements. -
datumGet(
) → JSAny? -
Available on Selection, provided by the SelectionDatum extension
Returns the bound datum for the first (non-null) element in the selection. -
datumSet(
Union2< EachCallback< ? value) → SelectionJSAny?> , JSAny?> -
Available on Selection, provided by the SelectionDatum extension
Sets the element’s bound data to the specified value on all selected elements. -
dispatch(
String type, [Union2< EachCallback< ? parameters]) → SelectionDispatchParams?> , DispatchParams?> -
Available on Selection, provided by the SelectionDispatch extension
Dispatches a custom event of the specified type to each selected element, in order. -
each(
EachCallback< void> function) → Selection -
Available on Selection, provided by the SelectionEach extension
Invokes the specified function for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with thisArg as the current DOM element (nodes[i]). -
elementAt(
int index) → Element? -
Returns the
index
th element.inherited -
empty(
) → bool -
Available on Selection, provided by the SelectionEmpty extension
Returns true if this selection contains no (non-null) elements. -
enter(
) → Selection -
Available on Selection, provided by the SelectionEnter extension
Returns the enter selection: placeholder nodes for each datum that had no corresponding DOM element in the selection. (The enter selection is empty for selections not returned by selection.dataBind.) -
every(
bool test(Element? element)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
exit(
) → Selection -
Available on Selection, provided by the SelectionExit extension
Returns the exit selection: existing DOM elements in the selection for which no new datum was found. (The exit selection is empty for selections not returned by selection.dataBind.) -
expand<
T> (Iterable< T> toElements(Element? element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
filter(
Union2< EachCallback< filter) → Selectionbool> , String> -
Available on Selection, provided by the SelectionFilter extension
Filters the selection, returning a new selection that contains only the elements for which the specified filter is true. -
firstWhere(
bool test(Element? element), {Element? orElse()?}) → Element? -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T previousValue, Element? element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< Element?> other) → Iterable<Element?> -
Creates the lazy concatenation of this iterable and
other
.inherited -
forEach(
void action(Element? element)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
htmlGet(
) → String? -
Available on Selection, provided by the SelectionHtml extension
Returns the inner HTML for the first (non-null) element in the selection. -
htmlSet(
Union2< EachCallback< ? value) → SelectionString?> , String> -
Available on Selection, provided by the SelectionHtml extension
Sets the inner HTML to the specified value on all selected elements, replacing any existing child elements. -
insert(
Union2< EachCallback< type, [Union2<Element> , String>EachCallback< ? before]) → SelectionElement?> , String> -
Available on Selection, provided by the SelectionInsert extension
If the specified type is a string, inserts a new element of this type (tag name) before the first element matching the specified before selector for each selected element. -
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
joind(
Union2< Selection? Function(Selection), String> onenter, [Selection? onupdate(Selection)?, void onexit(Selection)?]) → Selection? -
Available on Selection, provided by the SelectionJoin extension
Appends, removes and reorders elements as necessary to match the data that was previously bound by selection.dataBind, returning the merged enter and update selection. -
lastWhere(
bool test(Element? element), {Element? orElse()?}) → Element? -
The last element that satisfies the given predicate
test
.inherited -
lower(
) → Selection -
Available on Selection, provided by the SelectionLower extension
Re-inserts each selected element, in order, as the first child of its parent. Equivalent to: -
map<
T> (T toElement(Element? e)) → Iterable< T> -
The current elements of this iterable modified by
toElement
.inherited -
merge(
Selection other) → Selection -
Available on Selection, provided by the SelectionMerge extension
Returns a new selection merging this selection with the specified other selection or transition. -
node(
) → Element? -
Available on Selection, provided by the SelectionNode extension
Returns the first (non-null) element in this selection. If the selection is empty, returns null. -
nodes(
) → List< Element?> -
Available on Selection, provided by the SelectionNodes extension
Returns an list of all (non-null) elements in this selection. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onBind(
String typename, OnListener? listener, [JSAny? options]) → Selection -
Available on Selection, provided by the SelectionOn extension
Adds or removes a listener to each selected element for the specified event typenames. -
onGet(
String typename) → OnListener? -
Available on Selection, provided by the SelectionOn extension
Returns the currently-assigned listener for the specified event typename on the first (non-null) selected element, if any. -
order(
) → Selection -
Available on Selection, provided by the SelectionOrder extension
Re-inserts elements into the document such that the document order of each group matches the selection order. -
propertyGet(
String property) → JSAny? -
Available on Selection, provided by the SelectionProperty extension
Returns the value of the specified property for the first (non-null) element in the selection. -
propertySet(
String name, Union2< EachCallback< ? value) → SelectionJSAny?> , JSAny?> -
Available on Selection, provided by the SelectionProperty extension
Sets the property with the specified name to the specified value on selected elements. -
raise(
) → Selection -
Available on Selection, provided by the SelectionRaise extension
Re-inserts each selected element, in order, as the last child of its parent. -
reduce(
Element? combine(Element? value, Element? element)) → Element? -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
remove(
) → Selection -
Available on Selection, provided by the SelectionRemove extension
Removes the selected elements from the document. -
select(
[Union2< EachCallback< ? selector]) → SelectionElement?> , String> -
Available on Selection, provided by the SelectionSelect extension
For each selected element, selects the first descendant element that matches the specified selector string. -
selectAll(
[Union2< EachCallback< ? selector]) → SelectionIterable< , String>Element?> > -
Available on Selection, provided by the SelectionSelectAll extension
For each selected element, selects the descendant elements that match the specified selector string. -
selectChild(
[Union2< bool Function(Element, int, HTMLCollection), String> ? selector]) → Selection -
Available on Selection, provided by the SelectionSelectChild extension
Returns a new selection with the (first) child of each element of the current selection matching the selector. -
selectChildren(
[Union2< bool Function(Element, int, HTMLCollection), String> ? selector]) → Selection -
Available on Selection, provided by the SelectionSelectChildren extension
Returns a new selection with the children of each element of the current selection matching the selector. -
selection(
) → Selection -
Available on Selection, provided by the SelectionSelection extension
Returns the selection (for symmetry with transition.selection). -
singleWhere(
bool test(Element? element), {Element? orElse()?}) → Element? -
The single element that satisfies
test
.inherited -
size(
) → int -
Available on Selection, provided by the SelectionSize extension
Returns the total number of (non-null) elements in this selection. -
skip(
int count) → Iterable< Element?> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(Element? value)) → Iterable< Element?> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
sort(
Comparator< JSAny?> compare) → Selection -
Available on Selection, provided by the SelectionSort extension
Returns a new selection that contains a copy of each group in this selection sorted according to the compare function. After sorting, re-inserts elements to match the resulting order (per selection.order). -
styleGet(
String name) → String? -
Available on Selection, provided by the SelectionStyle extension
Returns the current value of the specified style property for the first (non-null) element in the selection. -
styleSet(
String name, Union2< EachCallback< ? value, [String priority = ""]) → SelectionString?> , String> -
Available on Selection, provided by the SelectionStyle extension
Sets the style property with the specified name to the specified value on the selected elements and returns this selection. -
take(
int count) → Iterable< Element?> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(Element? value)) → Iterable< Element?> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
textGet(
) → String? -
Available on Selection, provided by the SelectionText extension
Returns the text content for the first (non-null) element in the selection. -
textSet(
[Union2< EachCallback< ? value]) → SelectionString?> , String> -
Available on Selection, provided by the SelectionText extension
Sets the text content to the specified value on all selected elements, replacing any existing child elements. -
toList(
{bool growable = true}) → List< Element?> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< Element?> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
Returns a string representation of (some of) the elements of
this
.inherited -
where(
bool test(Element? element)) → Iterable< Element?> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited