@depup/cheerio 1.2.0-depup.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +36 -0
  3. package/Readme.md +229 -0
  4. package/changes.json +30 -0
  5. package/dist/browser/api/attributes.d.ts +385 -0
  6. package/dist/browser/api/attributes.d.ts.map +1 -0
  7. package/dist/browser/api/attributes.js +636 -0
  8. package/dist/browser/api/attributes.js.map +1 -0
  9. package/dist/browser/api/css.d.ts +42 -0
  10. package/dist/browser/api/css.d.ts.map +1 -0
  11. package/dist/browser/api/css.js +116 -0
  12. package/dist/browser/api/css.js.map +1 -0
  13. package/dist/browser/api/extract.d.ts +27 -0
  14. package/dist/browser/api/extract.d.ts.map +1 -0
  15. package/dist/browser/api/extract.js +42 -0
  16. package/dist/browser/api/extract.js.map +1 -0
  17. package/dist/browser/api/forms.d.ts +36 -0
  18. package/dist/browser/api/forms.d.ts.map +1 -0
  19. package/dist/browser/api/forms.js +81 -0
  20. package/dist/browser/api/forms.js.map +1 -0
  21. package/dist/browser/api/manipulation.d.ts +528 -0
  22. package/dist/browser/api/manipulation.d.ts.map +1 -0
  23. package/dist/browser/api/manipulation.js +831 -0
  24. package/dist/browser/api/manipulation.js.map +1 -0
  25. package/dist/browser/api/traversing.d.ts +657 -0
  26. package/dist/browser/api/traversing.d.ts.map +1 -0
  27. package/dist/browser/api/traversing.js +857 -0
  28. package/dist/browser/api/traversing.js.map +1 -0
  29. package/dist/browser/cheerio.d.ts +85 -0
  30. package/dist/browser/cheerio.d.ts.map +1 -0
  31. package/dist/browser/cheerio.js +58 -0
  32. package/dist/browser/cheerio.js.map +1 -0
  33. package/dist/browser/index-browser.d.mts.map +1 -0
  34. package/dist/browser/index-browser.mjs.map +1 -0
  35. package/dist/browser/index.d.ts +5 -0
  36. package/dist/browser/index.js +3 -0
  37. package/dist/browser/load-parse.d.ts +20 -0
  38. package/dist/browser/load-parse.d.ts.map +1 -0
  39. package/dist/browser/load-parse.js +28 -0
  40. package/dist/browser/load-parse.js.map +1 -0
  41. package/dist/browser/load.d.ts +91 -0
  42. package/dist/browser/load.d.ts.map +1 -0
  43. package/dist/browser/load.js +129 -0
  44. package/dist/browser/load.js.map +1 -0
  45. package/dist/browser/options.d.ts +98 -0
  46. package/dist/browser/options.d.ts.map +1 -0
  47. package/dist/browser/options.js +34 -0
  48. package/dist/browser/options.js.map +1 -0
  49. package/dist/browser/package.json +3 -0
  50. package/dist/browser/parse.d.ts +18 -0
  51. package/dist/browser/parse.d.ts.map +1 -0
  52. package/dist/browser/parse.js +73 -0
  53. package/dist/browser/parse.js.map +1 -0
  54. package/dist/browser/parsers/parse5-adapter.d.ts +20 -0
  55. package/dist/browser/parsers/parse5-adapter.d.ts.map +1 -0
  56. package/dist/browser/parsers/parse5-adapter.js +50 -0
  57. package/dist/browser/parsers/parse5-adapter.js.map +1 -0
  58. package/dist/browser/slim.d.ts +25 -0
  59. package/dist/browser/slim.d.ts.map +1 -0
  60. package/dist/browser/slim.js +22 -0
  61. package/dist/browser/slim.js.map +1 -0
  62. package/dist/browser/static.d.ts +112 -0
  63. package/dist/browser/static.d.ts.map +1 -0
  64. package/dist/browser/static.js +204 -0
  65. package/dist/browser/static.js.map +1 -0
  66. package/dist/browser/types.d.ts +21 -0
  67. package/dist/browser/types.d.ts.map +1 -0
  68. package/dist/browser/types.js +3 -0
  69. package/dist/browser/types.js.map +1 -0
  70. package/dist/browser/utils.d.ts +55 -0
  71. package/dist/browser/utils.d.ts.map +1 -0
  72. package/dist/browser/utils.js +84 -0
  73. package/dist/browser/utils.js.map +1 -0
  74. package/dist/commonjs/api/attributes.d.ts +385 -0
  75. package/dist/commonjs/api/attributes.d.ts.map +1 -0
  76. package/dist/commonjs/api/attributes.js +647 -0
  77. package/dist/commonjs/api/attributes.js.map +1 -0
  78. package/dist/commonjs/api/css.d.ts +42 -0
  79. package/dist/commonjs/api/css.d.ts.map +1 -0
  80. package/dist/commonjs/api/css.js +119 -0
  81. package/dist/commonjs/api/css.js.map +1 -0
  82. package/dist/commonjs/api/extract.d.ts +27 -0
  83. package/dist/commonjs/api/extract.d.ts.map +1 -0
  84. package/dist/commonjs/api/extract.js +45 -0
  85. package/dist/commonjs/api/extract.js.map +1 -0
  86. package/dist/commonjs/api/forms.d.ts +36 -0
  87. package/dist/commonjs/api/forms.d.ts.map +1 -0
  88. package/dist/commonjs/api/forms.js +85 -0
  89. package/dist/commonjs/api/forms.js.map +1 -0
  90. package/dist/commonjs/api/manipulation.d.ts +528 -0
  91. package/dist/commonjs/api/manipulation.d.ts.map +1 -0
  92. package/dist/commonjs/api/manipulation.js +850 -0
  93. package/dist/commonjs/api/manipulation.js.map +1 -0
  94. package/dist/commonjs/api/traversing.d.ts +657 -0
  95. package/dist/commonjs/api/traversing.d.ts.map +1 -0
  96. package/dist/commonjs/api/traversing.js +914 -0
  97. package/dist/commonjs/api/traversing.js.map +1 -0
  98. package/dist/commonjs/cheerio.d.ts +85 -0
  99. package/dist/commonjs/cheerio.d.ts.map +1 -0
  100. package/dist/commonjs/cheerio.js +95 -0
  101. package/dist/commonjs/cheerio.js.map +1 -0
  102. package/dist/commonjs/index.d.ts +104 -0
  103. package/dist/commonjs/index.d.ts.map +1 -0
  104. package/dist/commonjs/index.js +250 -0
  105. package/dist/commonjs/index.js.map +1 -0
  106. package/dist/commonjs/load-parse.d.ts +20 -0
  107. package/dist/commonjs/load-parse.d.ts.map +1 -0
  108. package/dist/commonjs/load-parse.js +34 -0
  109. package/dist/commonjs/load-parse.js.map +1 -0
  110. package/dist/commonjs/load.d.ts +91 -0
  111. package/dist/commonjs/load.d.ts.map +1 -0
  112. package/dist/commonjs/load.js +165 -0
  113. package/dist/commonjs/load.js.map +1 -0
  114. package/dist/commonjs/options.d.ts +98 -0
  115. package/dist/commonjs/options.d.ts.map +1 -0
  116. package/dist/commonjs/options.js +37 -0
  117. package/dist/commonjs/options.js.map +1 -0
  118. package/dist/commonjs/package.json +3 -0
  119. package/dist/commonjs/parse.d.ts +18 -0
  120. package/dist/commonjs/parse.d.ts.map +1 -0
  121. package/dist/commonjs/parse.js +77 -0
  122. package/dist/commonjs/parse.js.map +1 -0
  123. package/dist/commonjs/parsers/parse5-adapter.d.ts +20 -0
  124. package/dist/commonjs/parsers/parse5-adapter.d.ts.map +1 -0
  125. package/dist/commonjs/parsers/parse5-adapter.js +54 -0
  126. package/dist/commonjs/parsers/parse5-adapter.js.map +1 -0
  127. package/dist/commonjs/slim.d.ts +25 -0
  128. package/dist/commonjs/slim.d.ts.map +1 -0
  129. package/dist/commonjs/slim.js +30 -0
  130. package/dist/commonjs/slim.js.map +1 -0
  131. package/dist/commonjs/static.d.ts +112 -0
  132. package/dist/commonjs/static.d.ts.map +1 -0
  133. package/dist/commonjs/static.js +214 -0
  134. package/dist/commonjs/static.js.map +1 -0
  135. package/dist/commonjs/types.d.ts +21 -0
  136. package/dist/commonjs/types.d.ts.map +1 -0
  137. package/dist/commonjs/types.js +4 -0
  138. package/dist/commonjs/types.js.map +1 -0
  139. package/dist/commonjs/utils.d.ts +55 -0
  140. package/dist/commonjs/utils.d.ts.map +1 -0
  141. package/dist/commonjs/utils.js +91 -0
  142. package/dist/commonjs/utils.js.map +1 -0
  143. package/dist/esm/api/attributes.d.ts +385 -0
  144. package/dist/esm/api/attributes.d.ts.map +1 -0
  145. package/dist/esm/api/attributes.js +636 -0
  146. package/dist/esm/api/attributes.js.map +1 -0
  147. package/dist/esm/api/css.d.ts +42 -0
  148. package/dist/esm/api/css.d.ts.map +1 -0
  149. package/dist/esm/api/css.js +116 -0
  150. package/dist/esm/api/css.js.map +1 -0
  151. package/dist/esm/api/extract.d.ts +27 -0
  152. package/dist/esm/api/extract.d.ts.map +1 -0
  153. package/dist/esm/api/extract.js +42 -0
  154. package/dist/esm/api/extract.js.map +1 -0
  155. package/dist/esm/api/forms.d.ts +36 -0
  156. package/dist/esm/api/forms.d.ts.map +1 -0
  157. package/dist/esm/api/forms.js +81 -0
  158. package/dist/esm/api/forms.js.map +1 -0
  159. package/dist/esm/api/manipulation.d.ts +528 -0
  160. package/dist/esm/api/manipulation.d.ts.map +1 -0
  161. package/dist/esm/api/manipulation.js +831 -0
  162. package/dist/esm/api/manipulation.js.map +1 -0
  163. package/dist/esm/api/traversing.d.ts +657 -0
  164. package/dist/esm/api/traversing.d.ts.map +1 -0
  165. package/dist/esm/api/traversing.js +857 -0
  166. package/dist/esm/api/traversing.js.map +1 -0
  167. package/dist/esm/cheerio.d.ts +85 -0
  168. package/dist/esm/cheerio.d.ts.map +1 -0
  169. package/dist/esm/cheerio.js +58 -0
  170. package/dist/esm/cheerio.js.map +1 -0
  171. package/dist/esm/index.d.ts +104 -0
  172. package/dist/esm/index.d.ts.map +1 -0
  173. package/dist/esm/index.js +202 -0
  174. package/dist/esm/index.js.map +1 -0
  175. package/dist/esm/load-parse.d.ts +20 -0
  176. package/dist/esm/load-parse.d.ts.map +1 -0
  177. package/dist/esm/load-parse.js +28 -0
  178. package/dist/esm/load-parse.js.map +1 -0
  179. package/dist/esm/load.d.ts +91 -0
  180. package/dist/esm/load.d.ts.map +1 -0
  181. package/dist/esm/load.js +129 -0
  182. package/dist/esm/load.js.map +1 -0
  183. package/dist/esm/options.d.ts +98 -0
  184. package/dist/esm/options.d.ts.map +1 -0
  185. package/dist/esm/options.js +34 -0
  186. package/dist/esm/options.js.map +1 -0
  187. package/dist/esm/package.json +3 -0
  188. package/dist/esm/parse.d.ts +18 -0
  189. package/dist/esm/parse.d.ts.map +1 -0
  190. package/dist/esm/parse.js +73 -0
  191. package/dist/esm/parse.js.map +1 -0
  192. package/dist/esm/parsers/parse5-adapter.d.ts +20 -0
  193. package/dist/esm/parsers/parse5-adapter.d.ts.map +1 -0
  194. package/dist/esm/parsers/parse5-adapter.js +50 -0
  195. package/dist/esm/parsers/parse5-adapter.js.map +1 -0
  196. package/dist/esm/slim.d.ts +25 -0
  197. package/dist/esm/slim.d.ts.map +1 -0
  198. package/dist/esm/slim.js +22 -0
  199. package/dist/esm/slim.js.map +1 -0
  200. package/dist/esm/static.d.ts +112 -0
  201. package/dist/esm/static.d.ts.map +1 -0
  202. package/dist/esm/static.js +204 -0
  203. package/dist/esm/static.js.map +1 -0
  204. package/dist/esm/types.d.ts +21 -0
  205. package/dist/esm/types.d.ts.map +1 -0
  206. package/dist/esm/types.js +3 -0
  207. package/dist/esm/types.js.map +1 -0
  208. package/dist/esm/utils.d.ts +55 -0
  209. package/dist/esm/utils.d.ts.map +1 -0
  210. package/dist/esm/utils.js +84 -0
  211. package/dist/esm/utils.js.map +1 -0
  212. package/package.json +219 -0
  213. package/src/api/attributes.ts +1145 -0
  214. package/src/api/css.ts +224 -0
  215. package/src/api/extract.ts +92 -0
  216. package/src/api/forms.ts +103 -0
  217. package/src/api/manipulation.ts +1115 -0
  218. package/src/api/traversing.ts +1175 -0
  219. package/src/cheerio.ts +143 -0
  220. package/src/index-browser.mts +10 -0
  221. package/src/index.ts +294 -0
  222. package/src/load-parse.ts +39 -0
  223. package/src/load.ts +282 -0
  224. package/src/options.ts +136 -0
  225. package/src/parse.ts +105 -0
  226. package/src/parsers/parse5-adapter.ts +66 -0
  227. package/src/slim.ts +33 -0
  228. package/src/static.ts +312 -0
  229. package/src/types.ts +58 -0
  230. package/src/utils.ts +99 -0
@@ -0,0 +1,528 @@
1
+ /**
2
+ * Methods for modifying the DOM structure.
3
+ *
4
+ * @module cheerio/manipulation
5
+ */
6
+ import { type AnyNode } from 'domhandler';
7
+ import type { Cheerio } from '../cheerio.js';
8
+ import type { BasicAcceptedElems, AcceptedElems } from '../types.js';
9
+ /**
10
+ * Create an array of nodes, recursing into arrays and parsing strings if
11
+ * necessary.
12
+ *
13
+ * @private
14
+ * @category Manipulation
15
+ * @param elem - Elements to make an array of.
16
+ * @param clone - Optionally clone nodes.
17
+ * @returns The array of nodes.
18
+ */
19
+ export declare function _makeDomArray<T extends AnyNode>(this: Cheerio<T>, elem?: BasicAcceptedElems<AnyNode> | BasicAcceptedElems<AnyNode>[], clone?: boolean): AnyNode[];
20
+ /**
21
+ * Insert every element in the set of matched elements to the end of the target.
22
+ *
23
+ * @category Manipulation
24
+ * @example
25
+ *
26
+ * ```js
27
+ * $('<li class="plum">Plum</li>').appendTo('#fruits');
28
+ * $.html();
29
+ * //=> <ul id="fruits">
30
+ * // <li class="apple">Apple</li>
31
+ * // <li class="orange">Orange</li>
32
+ * // <li class="pear">Pear</li>
33
+ * // <li class="plum">Plum</li>
34
+ * // </ul>
35
+ * ```
36
+ *
37
+ * @param target - Element to append elements to.
38
+ * @returns The instance itself.
39
+ * @see {@link https://api.jquery.com/appendTo/}
40
+ */
41
+ export declare function appendTo<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;
42
+ /**
43
+ * Insert every element in the set of matched elements to the beginning of the
44
+ * target.
45
+ *
46
+ * @category Manipulation
47
+ * @example
48
+ *
49
+ * ```js
50
+ * $('<li class="plum">Plum</li>').prependTo('#fruits');
51
+ * $.html();
52
+ * //=> <ul id="fruits">
53
+ * // <li class="plum">Plum</li>
54
+ * // <li class="apple">Apple</li>
55
+ * // <li class="orange">Orange</li>
56
+ * // <li class="pear">Pear</li>
57
+ * // </ul>
58
+ * ```
59
+ *
60
+ * @param target - Element to prepend elements to.
61
+ * @returns The instance itself.
62
+ * @see {@link https://api.jquery.com/prependTo/}
63
+ */
64
+ export declare function prependTo<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;
65
+ /**
66
+ * Inserts content as the _last_ child of each of the selected elements.
67
+ *
68
+ * @category Manipulation
69
+ * @example
70
+ *
71
+ * ```js
72
+ * $('ul').append('<li class="plum">Plum</li>');
73
+ * $.html();
74
+ * //=> <ul id="fruits">
75
+ * // <li class="apple">Apple</li>
76
+ * // <li class="orange">Orange</li>
77
+ * // <li class="pear">Pear</li>
78
+ * // <li class="plum">Plum</li>
79
+ * // </ul>
80
+ * ```
81
+ *
82
+ * @see {@link https://api.jquery.com/append/}
83
+ */
84
+ export declare const append: <T extends AnyNode>(this: Cheerio<T>, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>] | BasicAcceptedElems<AnyNode>[]) => Cheerio<T>;
85
+ /**
86
+ * Inserts content as the _first_ child of each of the selected elements.
87
+ *
88
+ * @category Manipulation
89
+ * @example
90
+ *
91
+ * ```js
92
+ * $('ul').prepend('<li class="plum">Plum</li>');
93
+ * $.html();
94
+ * //=> <ul id="fruits">
95
+ * // <li class="plum">Plum</li>
96
+ * // <li class="apple">Apple</li>
97
+ * // <li class="orange">Orange</li>
98
+ * // <li class="pear">Pear</li>
99
+ * // </ul>
100
+ * ```
101
+ *
102
+ * @see {@link https://api.jquery.com/prepend/}
103
+ */
104
+ export declare const prepend: <T extends AnyNode>(this: Cheerio<T>, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>] | BasicAcceptedElems<AnyNode>[]) => Cheerio<T>;
105
+ /**
106
+ * The .wrap() function can take any string or object that could be passed to
107
+ * the $() factory function to specify a DOM structure. This structure may be
108
+ * nested several levels deep, but should contain only one inmost element. A
109
+ * copy of this structure will be wrapped around each of the elements in the set
110
+ * of matched elements. This method returns the original set of elements for
111
+ * chaining purposes.
112
+ *
113
+ * @category Manipulation
114
+ * @example
115
+ *
116
+ * ```js
117
+ * const redFruit = $('<div class="red-fruit"></div>');
118
+ * $('.apple').wrap(redFruit);
119
+ *
120
+ * //=> <ul id="fruits">
121
+ * // <div class="red-fruit">
122
+ * // <li class="apple">Apple</li>
123
+ * // </div>
124
+ * // <li class="orange">Orange</li>
125
+ * // <li class="plum">Plum</li>
126
+ * // </ul>
127
+ *
128
+ * const healthy = $('<div class="healthy"></div>');
129
+ * $('li').wrap(healthy);
130
+ *
131
+ * //=> <ul id="fruits">
132
+ * // <div class="healthy">
133
+ * // <li class="apple">Apple</li>
134
+ * // </div>
135
+ * // <div class="healthy">
136
+ * // <li class="orange">Orange</li>
137
+ * // </div>
138
+ * // <div class="healthy">
139
+ * // <li class="plum">Plum</li>
140
+ * // </div>
141
+ * // </ul>
142
+ * ```
143
+ *
144
+ * @param wrapper - The DOM structure to wrap around each element in the
145
+ * selection.
146
+ * @see {@link https://api.jquery.com/wrap/}
147
+ */
148
+ export declare const wrap: <T extends AnyNode>(this: Cheerio<T>, wrapper: AcceptedElems<AnyNode>) => Cheerio<T>;
149
+ /**
150
+ * The .wrapInner() function can take any string or object that could be passed
151
+ * to the $() factory function to specify a DOM structure. This structure may be
152
+ * nested several levels deep, but should contain only one inmost element. The
153
+ * structure will be wrapped around the content of each of the elements in the
154
+ * set of matched elements.
155
+ *
156
+ * @category Manipulation
157
+ * @example
158
+ *
159
+ * ```js
160
+ * const redFruit = $('<div class="red-fruit"></div>');
161
+ * $('.apple').wrapInner(redFruit);
162
+ *
163
+ * //=> <ul id="fruits">
164
+ * // <li class="apple">
165
+ * // <div class="red-fruit">Apple</div>
166
+ * // </li>
167
+ * // <li class="orange">Orange</li>
168
+ * // <li class="pear">Pear</li>
169
+ * // </ul>
170
+ *
171
+ * const healthy = $('<div class="healthy"></div>');
172
+ * $('li').wrapInner(healthy);
173
+ *
174
+ * //=> <ul id="fruits">
175
+ * // <li class="apple">
176
+ * // <div class="healthy">Apple</div>
177
+ * // </li>
178
+ * // <li class="orange">
179
+ * // <div class="healthy">Orange</div>
180
+ * // </li>
181
+ * // <li class="pear">
182
+ * // <div class="healthy">Pear</div>
183
+ * // </li>
184
+ * // </ul>
185
+ * ```
186
+ *
187
+ * @param wrapper - The DOM structure to wrap around the content of each element
188
+ * in the selection.
189
+ * @returns The instance itself, for chaining.
190
+ * @see {@link https://api.jquery.com/wrapInner/}
191
+ */
192
+ export declare const wrapInner: <T extends AnyNode>(this: Cheerio<T>, wrapper: AcceptedElems<AnyNode>) => Cheerio<T>;
193
+ /**
194
+ * The .unwrap() function, removes the parents of the set of matched elements
195
+ * from the DOM, leaving the matched elements in their place.
196
+ *
197
+ * @category Manipulation
198
+ * @example <caption>without selector</caption>
199
+ *
200
+ * ```js
201
+ * const $ = cheerio.load(
202
+ * '<div id=test>\n <div><p>Hello</p></div>\n <div><p>World</p></div>\n</div>',
203
+ * );
204
+ * $('#test p').unwrap();
205
+ *
206
+ * //=> <div id=test>
207
+ * // <p>Hello</p>
208
+ * // <p>World</p>
209
+ * // </div>
210
+ * ```
211
+ *
212
+ * @example <caption>with selector</caption>
213
+ *
214
+ * ```js
215
+ * const $ = cheerio.load(
216
+ * '<div id=test>\n <p>Hello</p>\n <b><p>World</p></b>\n</div>',
217
+ * );
218
+ * $('#test p').unwrap('b');
219
+ *
220
+ * //=> <div id=test>
221
+ * // <p>Hello</p>
222
+ * // <p>World</p>
223
+ * // </div>
224
+ * ```
225
+ *
226
+ * @param selector - A selector to check the parent element against. If an
227
+ * element's parent does not match the selector, the element won't be
228
+ * unwrapped.
229
+ * @returns The instance itself, for chaining.
230
+ * @see {@link https://api.jquery.com/unwrap/}
231
+ */
232
+ export declare function unwrap<T extends AnyNode>(this: Cheerio<T>, selector?: string): Cheerio<T>;
233
+ /**
234
+ * The .wrapAll() function can take any string or object that could be passed to
235
+ * the $() function to specify a DOM structure. This structure may be nested
236
+ * several levels deep, but should contain only one inmost element. The
237
+ * structure will be wrapped around all of the elements in the set of matched
238
+ * elements, as a single group.
239
+ *
240
+ * @category Manipulation
241
+ * @example <caption>With markup passed to `wrapAll`</caption>
242
+ *
243
+ * ```js
244
+ * const $ = cheerio.load(
245
+ * '<div class="container"><div class="inner">First</div><div class="inner">Second</div></div>',
246
+ * );
247
+ * $('.inner').wrapAll("<div class='new'></div>");
248
+ *
249
+ * //=> <div class="container">
250
+ * // <div class='new'>
251
+ * // <div class="inner">First</div>
252
+ * // <div class="inner">Second</div>
253
+ * // </div>
254
+ * // </div>
255
+ * ```
256
+ *
257
+ * @example <caption>With an existing cheerio instance</caption>
258
+ *
259
+ * ```js
260
+ * const $ = cheerio.load(
261
+ * '<span>Span 1</span><strong>Strong</strong><span>Span 2</span>',
262
+ * );
263
+ * const wrap = $('<div><p><em><b></b></em></p></div>');
264
+ * $('span').wrapAll(wrap);
265
+ *
266
+ * //=> <div>
267
+ * // <p>
268
+ * // <em>
269
+ * // <b>
270
+ * // <span>Span 1</span>
271
+ * // <span>Span 2</span>
272
+ * // </b>
273
+ * // </em>
274
+ * // </p>
275
+ * // </div>
276
+ * // <strong>Strong</strong>
277
+ * ```
278
+ *
279
+ * @param wrapper - The DOM structure to wrap around all matched elements in the
280
+ * selection.
281
+ * @returns The instance itself.
282
+ * @see {@link https://api.jquery.com/wrapAll/}
283
+ */
284
+ export declare function wrapAll<T extends AnyNode>(this: Cheerio<T>, wrapper: AcceptedElems<T>): Cheerio<T>;
285
+ /**
286
+ * Insert content next to each element in the set of matched elements.
287
+ *
288
+ * @category Manipulation
289
+ * @example
290
+ *
291
+ * ```js
292
+ * $('.apple').after('<li class="plum">Plum</li>');
293
+ * $.html();
294
+ * //=> <ul id="fruits">
295
+ * // <li class="apple">Apple</li>
296
+ * // <li class="plum">Plum</li>
297
+ * // <li class="orange">Orange</li>
298
+ * // <li class="pear">Pear</li>
299
+ * // </ul>
300
+ * ```
301
+ *
302
+ * @param elems - HTML string, DOM element, array of DOM elements or Cheerio to
303
+ * insert after each element in the set of matched elements.
304
+ * @returns The instance itself.
305
+ * @see {@link https://api.jquery.com/after/}
306
+ */
307
+ export declare function after<T extends AnyNode>(this: Cheerio<T>, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;
308
+ /**
309
+ * Insert every element in the set of matched elements after the target.
310
+ *
311
+ * @category Manipulation
312
+ * @example
313
+ *
314
+ * ```js
315
+ * $('<li class="plum">Plum</li>').insertAfter('.apple');
316
+ * $.html();
317
+ * //=> <ul id="fruits">
318
+ * // <li class="apple">Apple</li>
319
+ * // <li class="plum">Plum</li>
320
+ * // <li class="orange">Orange</li>
321
+ * // <li class="pear">Pear</li>
322
+ * // </ul>
323
+ * ```
324
+ *
325
+ * @param target - Element to insert elements after.
326
+ * @returns The set of newly inserted elements.
327
+ * @see {@link https://api.jquery.com/insertAfter/}
328
+ */
329
+ export declare function insertAfter<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;
330
+ /**
331
+ * Insert content previous to each element in the set of matched elements.
332
+ *
333
+ * @category Manipulation
334
+ * @example
335
+ *
336
+ * ```js
337
+ * $('.apple').before('<li class="plum">Plum</li>');
338
+ * $.html();
339
+ * //=> <ul id="fruits">
340
+ * // <li class="plum">Plum</li>
341
+ * // <li class="apple">Apple</li>
342
+ * // <li class="orange">Orange</li>
343
+ * // <li class="pear">Pear</li>
344
+ * // </ul>
345
+ * ```
346
+ *
347
+ * @param elems - HTML string, DOM element, array of DOM elements or Cheerio to
348
+ * insert before each element in the set of matched elements.
349
+ * @returns The instance itself.
350
+ * @see {@link https://api.jquery.com/before/}
351
+ */
352
+ export declare function before<T extends AnyNode>(this: Cheerio<T>, ...elems: [(this: AnyNode, i: number, html: string) => BasicAcceptedElems<AnyNode>] | BasicAcceptedElems<AnyNode>[]): Cheerio<T>;
353
+ /**
354
+ * Insert every element in the set of matched elements before the target.
355
+ *
356
+ * @category Manipulation
357
+ * @example
358
+ *
359
+ * ```js
360
+ * $('<li class="plum">Plum</li>').insertBefore('.apple');
361
+ * $.html();
362
+ * //=> <ul id="fruits">
363
+ * // <li class="plum">Plum</li>
364
+ * // <li class="apple">Apple</li>
365
+ * // <li class="orange">Orange</li>
366
+ * // <li class="pear">Pear</li>
367
+ * // </ul>
368
+ * ```
369
+ *
370
+ * @param target - Element to insert elements before.
371
+ * @returns The set of newly inserted elements.
372
+ * @see {@link https://api.jquery.com/insertBefore/}
373
+ */
374
+ export declare function insertBefore<T extends AnyNode>(this: Cheerio<T>, target: BasicAcceptedElems<AnyNode>): Cheerio<T>;
375
+ /**
376
+ * Removes the set of matched elements from the DOM and all their children.
377
+ * `selector` filters the set of matched elements to be removed.
378
+ *
379
+ * @category Manipulation
380
+ * @example
381
+ *
382
+ * ```js
383
+ * $('.pear').remove();
384
+ * $.html();
385
+ * //=> <ul id="fruits">
386
+ * // <li class="apple">Apple</li>
387
+ * // <li class="orange">Orange</li>
388
+ * // </ul>
389
+ * ```
390
+ *
391
+ * @param selector - Optional selector for elements to remove.
392
+ * @returns The instance itself.
393
+ * @see {@link https://api.jquery.com/remove/}
394
+ */
395
+ export declare function remove<T extends AnyNode>(this: Cheerio<T>, selector?: string): Cheerio<T>;
396
+ /**
397
+ * Replaces matched elements with `content`.
398
+ *
399
+ * @category Manipulation
400
+ * @example
401
+ *
402
+ * ```js
403
+ * const plum = $('<li class="plum">Plum</li>');
404
+ * $('.pear').replaceWith(plum);
405
+ * $.html();
406
+ * //=> <ul id="fruits">
407
+ * // <li class="apple">Apple</li>
408
+ * // <li class="orange">Orange</li>
409
+ * // <li class="plum">Plum</li>
410
+ * // </ul>
411
+ * ```
412
+ *
413
+ * @param content - Replacement for matched elements.
414
+ * @returns The instance itself.
415
+ * @see {@link https://api.jquery.com/replaceWith/}
416
+ */
417
+ export declare function replaceWith<T extends AnyNode>(this: Cheerio<T>, content: AcceptedElems<AnyNode>): Cheerio<T>;
418
+ /**
419
+ * Removes all children from each item in the selection. Text nodes and comment
420
+ * nodes are left as is.
421
+ *
422
+ * @category Manipulation
423
+ * @example
424
+ *
425
+ * ```js
426
+ * $('ul').empty();
427
+ * $.html();
428
+ * //=> <ul id="fruits"></ul>
429
+ * ```
430
+ *
431
+ * @returns The instance itself.
432
+ * @see {@link https://api.jquery.com/empty/}
433
+ */
434
+ export declare function empty<T extends AnyNode>(this: Cheerio<T>): Cheerio<T>;
435
+ /**
436
+ * Gets an HTML content string from the first selected element.
437
+ *
438
+ * @category Manipulation
439
+ * @example
440
+ *
441
+ * ```js
442
+ * $('.orange').html();
443
+ * //=> Orange
444
+ *
445
+ * $('#fruits').html('<li class="mango">Mango</li>').html();
446
+ * //=> <li class="mango">Mango</li>
447
+ * ```
448
+ *
449
+ * @returns The HTML content string.
450
+ * @see {@link https://api.jquery.com/html/}
451
+ */
452
+ export declare function html<T extends AnyNode>(this: Cheerio<T>): string | null;
453
+ /**
454
+ * Replaces each selected element's content with the specified content.
455
+ *
456
+ * @category Manipulation
457
+ * @example
458
+ *
459
+ * ```js
460
+ * $('.orange').html('<li class="mango">Mango</li>').html();
461
+ * //=> <li class="mango">Mango</li>
462
+ * ```
463
+ *
464
+ * @param str - The content to replace selection's contents with.
465
+ * @returns The instance itself.
466
+ * @see {@link https://api.jquery.com/html/}
467
+ */
468
+ export declare function html<T extends AnyNode>(this: Cheerio<T>, str: string | Cheerio<T>): Cheerio<T>;
469
+ /**
470
+ * Turns the collection to a string. Alias for `.html()`.
471
+ *
472
+ * @category Manipulation
473
+ * @returns The rendered document.
474
+ */
475
+ export declare function toString<T extends AnyNode>(this: Cheerio<T>): string;
476
+ /**
477
+ * Get the combined text contents of each element in the set of matched
478
+ * elements, including their descendants.
479
+ *
480
+ * @category Manipulation
481
+ * @example
482
+ *
483
+ * ```js
484
+ * $('.orange').text();
485
+ * //=> Orange
486
+ *
487
+ * $('ul').text();
488
+ * //=> Apple
489
+ * // Orange
490
+ * // Pear
491
+ * ```
492
+ *
493
+ * @returns The text contents of the collection.
494
+ * @see {@link https://api.jquery.com/text/}
495
+ */
496
+ export declare function text<T extends AnyNode>(this: Cheerio<T>): string;
497
+ /**
498
+ * Set the content of each element in the set of matched elements to the
499
+ * specified text.
500
+ *
501
+ * @category Manipulation
502
+ * @example
503
+ *
504
+ * ```js
505
+ * $('.orange').text('Orange');
506
+ * //=> <div class="orange">Orange</div>
507
+ * ```
508
+ *
509
+ * @param str - The text to set as the content of each matched element.
510
+ * @returns The instance itself.
511
+ * @see {@link https://api.jquery.com/text/}
512
+ */
513
+ export declare function text<T extends AnyNode>(this: Cheerio<T>, str: string | ((this: AnyNode, i: number, text: string) => string)): Cheerio<T>;
514
+ /**
515
+ * Clone the cheerio object.
516
+ *
517
+ * @category Manipulation
518
+ * @example
519
+ *
520
+ * ```js
521
+ * const moreFruit = $('#fruits').clone();
522
+ * ```
523
+ *
524
+ * @returns The cloned object.
525
+ * @see {@link https://api.jquery.com/clone/}
526
+ */
527
+ export declare function clone<T extends AnyNode>(this: Cheerio<T>): Cheerio<T>;
528
+ //# sourceMappingURL=manipulation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manipulation.d.ts","sourceRoot":"","sources":["../../../src/api/manipulation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAOL,KAAK,OAAO,EAEb,MAAM,YAAY,CAAC;AAKpB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGrE;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,OAAO,EAC7C,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,IAAI,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAAG,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAClE,KAAK,CAAC,EAAE,OAAO,GACd,OAAO,EAAE,CAqCX;AA+GD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,OAAO,EACxC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC,CAMZ;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,EACzC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAChB,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAClC,OAAO,CAAC,CAAC,CAAC,CAMZ;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MA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