traversing.d.ts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. /**
  2. * Methods for traversing the DOM structure.
  3. *
  4. * @module cheerio/traversing
  5. */
  6. import { type AnyNode, type Element, type Document } from 'domhandler';
  7. import type { Cheerio } from '../cheerio.js';
  8. import type { AcceptedFilters } from '../types.js';
  9. /**
  10. * Get the descendants of each element in the current set of matched elements,
  11. * filtered by a selector, jQuery object, or element.
  12. *
  13. * @category Traversing
  14. * @example
  15. *
  16. * ```js
  17. * $('#fruits').find('li').length;
  18. * //=> 3
  19. * $('#fruits').find($('.apple')).length;
  20. * //=> 1
  21. * ```
  22. *
  23. * @param selectorOrHaystack - Element to look for.
  24. * @returns The found elements.
  25. * @see {@link https://api.jquery.com/find/}
  26. */
  27. export declare function find<T extends AnyNode>(this: Cheerio<T>, selectorOrHaystack?: string | Cheerio<Element> | Element): Cheerio<Element>;
  28. /**
  29. * Find elements by a specific selector.
  30. *
  31. * @private
  32. * @category Traversing
  33. * @param selector - Selector to filter by.
  34. * @param limit - Maximum number of elements to match.
  35. * @returns The found elements.
  36. */
  37. export declare function _findBySelector<T extends AnyNode>(this: Cheerio<T>, selector: string, limit: number): Cheerio<Element>;
  38. /**
  39. * Get the parent of each element in the current set of matched elements,
  40. * optionally filtered by a selector.
  41. *
  42. * @category Traversing
  43. * @example
  44. *
  45. * ```js
  46. * $('.pear').parent().attr('id');
  47. * //=> fruits
  48. * ```
  49. *
  50. * @param selector - If specified filter for parent.
  51. * @returns The parents.
  52. * @see {@link https://api.jquery.com/parent/}
  53. */
  54. export declare const parent: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>) => Cheerio<Element>;
  55. /**
  56. * Get a set of parents filtered by `selector` of each element in the current
  57. * set of match elements.
  58. *
  59. * @category Traversing
  60. * @example
  61. *
  62. * ```js
  63. * $('.orange').parents().length;
  64. * //=> 2
  65. * $('.orange').parents('#fruits').length;
  66. * //=> 1
  67. * ```
  68. *
  69. * @param selector - If specified filter for parents.
  70. * @returns The parents.
  71. * @see {@link https://api.jquery.com/parents/}
  72. */
  73. export declare const parents: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>) => Cheerio<Element>;
  74. /**
  75. * Get the ancestors of each element in the current set of matched elements, up
  76. * to but not including the element matched by the selector, DOM node, or
  77. * cheerio object.
  78. *
  79. * @category Traversing
  80. * @example
  81. *
  82. * ```js
  83. * $('.orange').parentsUntil('#food').length;
  84. * //=> 1
  85. * ```
  86. *
  87. * @param selector - Selector for element to stop at.
  88. * @param filterSelector - Optional filter for parents.
  89. * @returns The parents.
  90. * @see {@link https://api.jquery.com/parentsUntil/}
  91. */
  92. export declare const parentsUntil: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element> | null, filterSelector?: AcceptedFilters<Element>) => Cheerio<Element>;
  93. /**
  94. * For each element in the set, get the first element that matches the selector
  95. * by testing the element itself and traversing up through its ancestors in the
  96. * DOM tree.
  97. *
  98. * @category Traversing
  99. * @example
  100. *
  101. * ```js
  102. * $('.orange').closest();
  103. * //=> []
  104. *
  105. * $('.orange').closest('.apple');
  106. * // => []
  107. *
  108. * $('.orange').closest('li');
  109. * //=> [<li class="orange">Orange</li>]
  110. *
  111. * $('.orange').closest('#fruits');
  112. * //=> [<ul id="fruits"> ... </ul>]
  113. * ```
  114. *
  115. * @param selector - Selector for the element to find.
  116. * @returns The closest nodes.
  117. * @see {@link https://api.jquery.com/closest/}
  118. */
  119. export declare function closest<T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>): Cheerio<AnyNode>;
  120. /**
  121. * Gets the next sibling of each selected element, optionally filtered by a
  122. * selector.
  123. *
  124. * @category Traversing
  125. * @example
  126. *
  127. * ```js
  128. * $('.apple').next().hasClass('orange');
  129. * //=> true
  130. * ```
  131. *
  132. * @param selector - If specified filter for sibling.
  133. * @returns The next nodes.
  134. * @see {@link https://api.jquery.com/next/}
  135. */
  136. export declare const next: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>) => Cheerio<Element>;
  137. /**
  138. * Gets all the following siblings of the each selected element, optionally
  139. * filtered by a selector.
  140. *
  141. * @category Traversing
  142. * @example
  143. *
  144. * ```js
  145. * $('.apple').nextAll();
  146. * //=> [<li class="orange">Orange</li>, <li class="pear">Pear</li>]
  147. * $('.apple').nextAll('.orange');
  148. * //=> [<li class="orange">Orange</li>]
  149. * ```
  150. *
  151. * @param selector - If specified filter for siblings.
  152. * @returns The next nodes.
  153. * @see {@link https://api.jquery.com/nextAll/}
  154. */
  155. export declare const nextAll: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>) => Cheerio<Element>;
  156. /**
  157. * Gets all the following siblings up to but not including the element matched
  158. * by the selector, optionally filtered by another selector.
  159. *
  160. * @category Traversing
  161. * @example
  162. *
  163. * ```js
  164. * $('.apple').nextUntil('.pear');
  165. * //=> [<li class="orange">Orange</li>]
  166. * ```
  167. *
  168. * @param selector - Selector for element to stop at.
  169. * @param filterSelector - If specified filter for siblings.
  170. * @returns The next nodes.
  171. * @see {@link https://api.jquery.com/nextUntil/}
  172. */
  173. export declare const nextUntil: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element> | null, filterSelector?: AcceptedFilters<Element>) => Cheerio<Element>;
  174. /**
  175. * Gets the previous sibling of each selected element optionally filtered by a
  176. * selector.
  177. *
  178. * @category Traversing
  179. * @example
  180. *
  181. * ```js
  182. * $('.orange').prev().hasClass('apple');
  183. * //=> true
  184. * ```
  185. *
  186. * @param selector - If specified filter for siblings.
  187. * @returns The previous nodes.
  188. * @see {@link https://api.jquery.com/prev/}
  189. */
  190. export declare const prev: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>) => Cheerio<Element>;
  191. /**
  192. * Gets all the preceding siblings of each selected element, optionally filtered
  193. * by a selector.
  194. *
  195. * @category Traversing
  196. * @example
  197. *
  198. * ```js
  199. * $('.pear').prevAll();
  200. * //=> [<li class="orange">Orange</li>, <li class="apple">Apple</li>]
  201. *
  202. * $('.pear').prevAll('.orange');
  203. * //=> [<li class="orange">Orange</li>]
  204. * ```
  205. *
  206. * @param selector - If specified filter for siblings.
  207. * @returns The previous nodes.
  208. * @see {@link https://api.jquery.com/prevAll/}
  209. */
  210. export declare const prevAll: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>) => Cheerio<Element>;
  211. /**
  212. * Gets all the preceding siblings up to but not including the element matched
  213. * by the selector, optionally filtered by another selector.
  214. *
  215. * @category Traversing
  216. * @example
  217. *
  218. * ```js
  219. * $('.pear').prevUntil('.apple');
  220. * //=> [<li class="orange">Orange</li>]
  221. * ```
  222. *
  223. * @param selector - Selector for element to stop at.
  224. * @param filterSelector - If specified filter for siblings.
  225. * @returns The previous nodes.
  226. * @see {@link https://api.jquery.com/prevUntil/}
  227. */
  228. export declare const prevUntil: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element> | null, filterSelector?: AcceptedFilters<Element>) => Cheerio<Element>;
  229. /**
  230. * Get the siblings of each element (excluding the element) in the set of
  231. * matched elements, optionally filtered by a selector.
  232. *
  233. * @category Traversing
  234. * @example
  235. *
  236. * ```js
  237. * $('.pear').siblings().length;
  238. * //=> 2
  239. *
  240. * $('.pear').siblings('.orange').length;
  241. * //=> 1
  242. * ```
  243. *
  244. * @param selector - If specified filter for siblings.
  245. * @returns The siblings.
  246. * @see {@link https://api.jquery.com/siblings/}
  247. */
  248. export declare const siblings: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>) => Cheerio<Element>;
  249. /**
  250. * Gets the element children of each element in the set of matched elements.
  251. *
  252. * @category Traversing
  253. * @example
  254. *
  255. * ```js
  256. * $('#fruits').children().length;
  257. * //=> 3
  258. *
  259. * $('#fruits').children('.pear').text();
  260. * //=> Pear
  261. * ```
  262. *
  263. * @param selector - If specified filter for children.
  264. * @returns The children.
  265. * @see {@link https://api.jquery.com/children/}
  266. */
  267. export declare const children: <T extends AnyNode>(this: Cheerio<T>, selector?: AcceptedFilters<Element>) => Cheerio<Element>;
  268. /**
  269. * Gets the children of each element in the set of matched elements, including
  270. * text and comment nodes.
  271. *
  272. * @category Traversing
  273. * @example
  274. *
  275. * ```js
  276. * $('#fruits').contents().length;
  277. * //=> 3
  278. * ```
  279. *
  280. * @returns The children.
  281. * @see {@link https://api.jquery.com/contents/}
  282. */
  283. export declare function contents<T extends AnyNode>(this: Cheerio<T>): Cheerio<AnyNode>;
  284. /**
  285. * Iterates over a cheerio object, executing a function for each matched
  286. * element. When the callback is fired, the function is fired in the context of
  287. * the DOM element, so `this` refers to the current element, which is equivalent
  288. * to the function parameter `element`. To break out of the `each` loop early,
  289. * return with `false`.
  290. *
  291. * @category Traversing
  292. * @example
  293. *
  294. * ```js
  295. * const fruits = [];
  296. *
  297. * $('li').each(function (i, elem) {
  298. * fruits[i] = $(this).text();
  299. * });
  300. *
  301. * fruits.join(', ');
  302. * //=> Apple, Orange, Pear
  303. * ```
  304. *
  305. * @param fn - Function to execute.
  306. * @returns The instance itself, useful for chaining.
  307. * @see {@link https://api.jquery.com/each/}
  308. */
  309. export declare function each<T>(this: Cheerio<T>, fn: (this: T, i: number, el: T) => void | boolean): Cheerio<T>;
  310. /**
  311. * Pass each element in the current matched set through a function, producing a
  312. * new Cheerio object containing the return values. The function can return an
  313. * individual data item or an array of data items to be inserted into the
  314. * resulting set. If an array is returned, the elements inside the array are
  315. * inserted into the set. If the function returns null or undefined, no element
  316. * will be inserted.
  317. *
  318. * @category Traversing
  319. * @example
  320. *
  321. * ```js
  322. * $('li')
  323. * .map(function (i, el) {
  324. * // this === el
  325. * return $(this).text();
  326. * })
  327. * .toArray()
  328. * .join(' ');
  329. * //=> "apple orange pear"
  330. * ```
  331. *
  332. * @param fn - Function to execute.
  333. * @returns The mapped elements, wrapped in a Cheerio collection.
  334. * @see {@link https://api.jquery.com/map/}
  335. */
  336. export declare function map<T, M>(this: Cheerio<T>, fn: (this: T, i: number, el: T) => M[] | M | null | undefined): Cheerio<M>;
  337. /**
  338. * Iterates over a cheerio object, reducing the set of selector elements to
  339. * those that match the selector or pass the function's test.
  340. *
  341. * This is the definition for using type guards; have a look below for other
  342. * ways to invoke this method. The function is executed in the context of the
  343. * selected element, so `this` refers to the current element.
  344. *
  345. * @category Traversing
  346. * @example <caption>Function</caption>
  347. *
  348. * ```js
  349. * $('li')
  350. * .filter(function (i, el) {
  351. * // this === el
  352. * return $(this).attr('class') === 'orange';
  353. * })
  354. * .attr('class'); //=> orange
  355. * ```
  356. *
  357. * @param match - Value to look for, following the rules above.
  358. * @returns The filtered collection.
  359. * @see {@link https://api.jquery.com/filter/}
  360. */
  361. export declare function filter<T, S extends T>(this: Cheerio<T>, match: (this: T, index: number, value: T) => value is S): Cheerio<S>;
  362. /**
  363. * Iterates over a cheerio object, reducing the set of selector elements to
  364. * those that match the selector or pass the function's test.
  365. *
  366. * - When a Cheerio selection is specified, return only the elements contained in
  367. * that selection.
  368. * - When an element is specified, return only that element (if it is contained in
  369. * the original selection).
  370. * - If using the function method, the function is executed in the context of the
  371. * selected element, so `this` refers to the current element.
  372. *
  373. * @category Traversing
  374. * @example <caption>Selector</caption>
  375. *
  376. * ```js
  377. * $('li').filter('.orange').attr('class');
  378. * //=> orange
  379. * ```
  380. *
  381. * @example <caption>Function</caption>
  382. *
  383. * ```js
  384. * $('li')
  385. * .filter(function (i, el) {
  386. * // this === el
  387. * return $(this).attr('class') === 'orange';
  388. * })
  389. * .attr('class'); //=> orange
  390. * ```
  391. *
  392. * @param match - Value to look for, following the rules above. See
  393. * {@link AcceptedFilters}.
  394. * @returns The filtered collection.
  395. * @see {@link https://api.jquery.com/filter/}
  396. */
  397. export declare function filter<T, S extends AcceptedFilters<T>>(this: Cheerio<T>, match: S): Cheerio<S extends string ? Element : T>;
  398. export declare function filterArray<T>(nodes: T[], match: AcceptedFilters<T>, xmlMode?: boolean, root?: Document): Element[] | T[];
  399. /**
  400. * Checks the current list of elements and returns `true` if _any_ of the
  401. * elements match the selector. If using an element or Cheerio selection,
  402. * returns `true` if _any_ of the elements match. If using a predicate function,
  403. * the function is executed in the context of the selected element, so `this`
  404. * refers to the current element.
  405. *
  406. * @category Traversing
  407. * @param selector - Selector for the selection.
  408. * @returns Whether or not the selector matches an element of the instance.
  409. * @see {@link https://api.jquery.com/is/}
  410. */
  411. export declare function is<T>(this: Cheerio<T>, selector?: AcceptedFilters<T>): boolean;
  412. /**
  413. * Remove elements from the set of matched elements. Given a Cheerio object that
  414. * represents a set of DOM elements, the `.not()` method constructs a new
  415. * Cheerio object from a subset of the matching elements. The supplied selector
  416. * is tested against each element; the elements that don't match the selector
  417. * will be included in the result.
  418. *
  419. * The `.not()` method can take a function as its argument in the same way that
  420. * `.filter()` does. Elements for which the function returns `true` are excluded
  421. * from the filtered set; all other elements are included.
  422. *
  423. * @category Traversing
  424. * @example <caption>Selector</caption>
  425. *
  426. * ```js
  427. * $('li').not('.apple').length;
  428. * //=> 2
  429. * ```
  430. *
  431. * @example <caption>Function</caption>
  432. *
  433. * ```js
  434. * $('li').not(function (i, el) {
  435. * // this === el
  436. * return $(this).attr('class') === 'orange';
  437. * }).length; //=> 2
  438. * ```
  439. *
  440. * @param match - Value to look for, following the rules above.
  441. * @returns The filtered collection.
  442. * @see {@link https://api.jquery.com/not/}
  443. */
  444. export declare function not<T extends AnyNode>(this: Cheerio<T>, match: AcceptedFilters<T>): Cheerio<T>;
  445. /**
  446. * Filters the set of matched elements to only those which have the given DOM
  447. * element as a descendant or which have a descendant that matches the given
  448. * selector. Equivalent to `.filter(':has(selector)')`.
  449. *
  450. * @category Traversing
  451. * @example <caption>Selector</caption>
  452. *
  453. * ```js
  454. * $('ul').has('.pear').attr('id');
  455. * //=> fruits
  456. * ```
  457. *
  458. * @example <caption>Element</caption>
  459. *
  460. * ```js
  461. * $('ul').has($('.pear')[0]).attr('id');
  462. * //=> fruits
  463. * ```
  464. *
  465. * @param selectorOrHaystack - Element to look for.
  466. * @returns The filtered collection.
  467. * @see {@link https://api.jquery.com/has/}
  468. */
  469. export declare function has(this: Cheerio<AnyNode | Element>, selectorOrHaystack: string | Cheerio<Element> | Element): Cheerio<AnyNode | Element>;
  470. /**
  471. * Will select the first element of a cheerio object.
  472. *
  473. * @category Traversing
  474. * @example
  475. *
  476. * ```js
  477. * $('#fruits').children().first().text();
  478. * //=> Apple
  479. * ```
  480. *
  481. * @returns The first element.
  482. * @see {@link https://api.jquery.com/first/}
  483. */
  484. export declare function first<T extends AnyNode>(this: Cheerio<T>): Cheerio<T>;
  485. /**
  486. * Will select the last element of a cheerio object.
  487. *
  488. * @category Traversing
  489. * @example
  490. *
  491. * ```js
  492. * $('#fruits').children().last().text();
  493. * //=> Pear
  494. * ```
  495. *
  496. * @returns The last element.
  497. * @see {@link https://api.jquery.com/last/}
  498. */
  499. export declare function last<T>(this: Cheerio<T>): Cheerio<T>;
  500. /**
  501. * Reduce the set of matched elements to the one at the specified index. Use
  502. * `.eq(-i)` to count backwards from the last selected element.
  503. *
  504. * @category Traversing
  505. * @example
  506. *
  507. * ```js
  508. * $('li').eq(0).text();
  509. * //=> Apple
  510. *
  511. * $('li').eq(-1).text();
  512. * //=> Pear
  513. * ```
  514. *
  515. * @param i - Index of the element to select.
  516. * @returns The element at the `i`th position.
  517. * @see {@link https://api.jquery.com/eq/}
  518. */
  519. export declare function eq<T>(this: Cheerio<T>, i: number): Cheerio<T>;
  520. /**
  521. * Retrieve one of the elements matched by the Cheerio object, at the `i`th
  522. * position.
  523. *
  524. * @category Traversing
  525. * @example
  526. *
  527. * ```js
  528. * $('li').get(0).tagName;
  529. * //=> li
  530. * ```
  531. *
  532. * @param i - Element to retrieve.
  533. * @returns The element at the `i`th position.
  534. * @see {@link https://api.jquery.com/get/}
  535. */
  536. export declare function get<T>(this: Cheerio<T>, i: number): T | undefined;
  537. /**
  538. * Retrieve all elements matched by the Cheerio object, as an array.
  539. *
  540. * @category Traversing
  541. * @example
  542. *
  543. * ```js
  544. * $('li').get().length;
  545. * //=> 3
  546. * ```
  547. *
  548. * @returns All elements matched by the Cheerio object.
  549. * @see {@link https://api.jquery.com/get/}
  550. */
  551. export declare function get<T>(this: Cheerio<T>): T[];
  552. /**
  553. * Retrieve all the DOM elements contained in the jQuery set as an array.
  554. *
  555. * @example
  556. *
  557. * ```js
  558. * $('li').toArray();
  559. * //=> [ {...}, {...}, {...} ]
  560. * ```
  561. *
  562. * @returns The contained items.
  563. */
  564. export declare function toArray<T>(this: Cheerio<T>): T[];
  565. /**
  566. * Search for a given element from among the matched elements.
  567. *
  568. * @category Traversing
  569. * @example
  570. *
  571. * ```js
  572. * $('.pear').index();
  573. * //=> 2 $('.orange').index('li');
  574. * //=> 1
  575. * $('.apple').index($('#fruit, li'));
  576. * //=> 1
  577. * ```
  578. *
  579. * @param selectorOrNeedle - Element to look for.
  580. * @returns The index of the element.
  581. * @see {@link https://api.jquery.com/index/}
  582. */
  583. export declare function index<T extends AnyNode>(this: Cheerio<T>, selectorOrNeedle?: string | Cheerio<AnyNode> | AnyNode): number;
  584. /**
  585. * Gets the elements matching the specified range (0-based position).
  586. *
  587. * @category Traversing
  588. * @example
  589. *
  590. * ```js
  591. * $('li').slice(1).eq(0).text();
  592. * //=> 'Orange'
  593. *
  594. * $('li').slice(1, 2).length;
  595. * //=> 1
  596. * ```
  597. *
  598. * @param start - A position at which the elements begin to be selected. If
  599. * negative, it indicates an offset from the end of the set.
  600. * @param end - A position at which the elements stop being selected. If
  601. * negative, it indicates an offset from the end of the set. If omitted, the
  602. * range continues until the end of the set.
  603. * @returns The elements matching the specified range.
  604. * @see {@link https://api.jquery.com/slice/}
  605. */
  606. export declare function slice<T>(this: Cheerio<T>, start?: number, end?: number): Cheerio<T>;
  607. /**
  608. * End the most recent filtering operation in the current chain and return the
  609. * set of matched elements to its previous state.
  610. *
  611. * @category Traversing
  612. * @example
  613. *
  614. * ```js
  615. * $('li').eq(0).end().length;
  616. * //=> 3
  617. * ```
  618. *
  619. * @returns The previous state of the set of matched elements.
  620. * @see {@link https://api.jquery.com/end/}
  621. */
  622. export declare function end<T>(this: Cheerio<T>): Cheerio<AnyNode>;
  623. /**
  624. * Add elements to the set of matched elements.
  625. *
  626. * @category Traversing
  627. * @example
  628. *
  629. * ```js
  630. * $('.apple').add('.orange').length;
  631. * //=> 2
  632. * ```
  633. *
  634. * @param other - Elements to add.
  635. * @param context - Optionally the context of the new selection.
  636. * @returns The combined set.
  637. * @see {@link https://api.jquery.com/add/}
  638. */
  639. export declare function add<S extends AnyNode, T extends AnyNode>(this: Cheerio<T>, other: string | Cheerio<S> | S | S[], context?: Cheerio<S> | string): Cheerio<S | T>;
  640. /**
  641. * Add the previous set of elements on the stack to the current set, optionally
  642. * filtered by a selector.
  643. *
  644. * @category Traversing
  645. * @example
  646. *
  647. * ```js
  648. * $('li').eq(0).addBack('.orange').length;
  649. * //=> 2
  650. * ```
  651. *
  652. * @param selector - Selector for the elements to add.
  653. * @returns The combined set.
  654. * @see {@link https://api.jquery.com/addBack/}
  655. */
  656. export declare function addBack<T extends AnyNode>(this: Cheerio<T>, selector?: string): Cheerio<AnyNode>;
  657. //# sourceMappingURL=traversing.d.ts.map