up.fragment.all([root], selector, [options])
JavaScript function
Returns all elements matching the given CSS selector, but ignores elements that are being destroyed or that are being removed by a transition.
By default this function only selects elements in the current layer.
Pass a { layer }option to match elements in other layers. See up.layer.get() for a list
of supported layer values.
Returns an empty list if no element matches these conditions.
Example
To select all elements with the selector .foo on the current layer:
let foos = up.fragment.all('.foo')
You may also pass a { layer } option to match elements within another layer:
let foos = up.fragment.all('.foo', { layer: 'any' })
To select in the descendants of an element, pass a root element as the first argument:
let container = up.fragment.get('.container')
let foosInContainer = up.fragment.all(container, '.foo')
Similar features
- The
.up-destroyingclass is assigned to elements during their removal animation. - The
up.element.all()function simply returns all elements matching a selector without further filtering.
Parameters
Search scope
The selector to match.
The layer in which to select elements.
See up.layer.get() for a list of supported layer values.
If a root element was passed as first argument, this option is ignored and the
root element's layer is searched.