Skip to main content

tagChildren

Tags a Taggable Element as a root to track one or more of its children by specifying a set of ChildrenTaggingQuery objects.

tagChildren = (parameters: ChildrenTaggingQueries) => TagLocationReturnValue
warning

tagChildren is a performance-sensitive API. Avoid using it whenever Location Taggers could be used instead.

Parameters

type
requiredparametersChildrenTaggingQueries
optionalonErrorTrackerErrorHandlerCallback

tagChild - Single query shorthand

Syntactic sugar API built on top of tagChildren which processes a single ChildrenTaggingQuery.

tagChild = (parameters: ChildrenTaggingQuery) => TagLocationReturnValue

Parameters

type
requiredparametersChildrenTaggingQuery
optionalonErrorTrackerErrorHandlerCallback

Returns

TagChildrenReturnValue

Usage example

import { tagChildren, tagPressable } from '@objectiv/tracker-browser';
<div
{...tagChildren([
{
queryAll: 'button[aria-label="Previous"]',
tagAs: tagPressable({ id: 'prev' })
},
{
queryAll: 'button[aria-label="Next"]',
tagAs: tagPressable({ id: 'next' })
}
])}
>
...
</div>