up.fragment up.fragment.first([root], selector, [options])
JavaScript function

This feature has been deprecated. Use up.fragment.get() instead.

Load unpoly-migrate.js to polyfill deprecated features.

Returns the first element matching the given selector, but ignores elements that are being destroyed or that are being removed by a transition.

Returns undefined if no element matches these conditions.


Parameters

[root=document]
optional

The root element for the search. Only the root's descendants will be matched.

May be omitted to search through all elements in the current document.

Type: Element | jQuery
selector
required

The selector to match

Type: string
[options.layer='current']
optional

The layer in which to find the element.

See Targeting other layers.

Type: string
[options.origin]
optional

A second element or selector that can be referenced as :origin in the first selector.

Type: string | Element | jQuery

Return value

The first element that is not being destroyed, or undefined if no such element was found.

Type: Element | undefined