Edit this page

up.fragment up.fragment.matches(fragment, selectorOrSelectors, [options])
JavaScript function

This feature is experimental. It may be changed or removed in a future version.

Returns whether the given element matches the given CSS selector.

Other than up.element.matches() this function supports non-standard selectors like :main or :layer.


fragment Element
selectorOrSelectors stringorArray<string>
[options.layer] stringorup.Layer optional

The layer for which to match.

Pseudo-selectors like :main may expand to different selectors in different layers.

[options.mode] stringorup.Layer optional

Required if { layer: 'new' } is passed.

Return value

This website uses cookies to improve usability and analyze traffic.
I accept or learn more