Edit this page

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] ElementorjQuery optional

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

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

selector string

The selector to match

[options.layer='current'] string optional

The the layer in which to find the element.

See Layer option.

[options.origin] stringorElementorjQuery optional

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

Return value

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