Skip to main content

Function: collect()

collect(subject, name?, options?): MutatableCollector | CollectorBuilder

Create a new named Collector.

Note: If parent is not specified, the library will attempt to discover the closest non-volatile parents of any Element that match the selector.

Parameters​

ParameterTypeDescription
subjectSubjectA CSS selector, XPath selector, or Element that the Collector should manage.
name?stringThe name of the Collector to be accessed from mutate.
options?CollectorOptions-

Returns​

MutatableCollector | CollectorBuilder

The Collector instance created. This Collector can be retrieved by name as well.

Example​

Collect the title for future mutating.

<h1 class="page-title">Title</h1>
collect('.page-title', 'title')