| |
| import type { InternalOptions } from './options.js'; |
| import type { AnyNode, Document, ParentNode } from 'domhandler'; |
| import type { BasicAcceptedElems } from './types.js'; |
|
|
| import * as Attributes from './api/attributes.js'; |
| import * as Traversing from './api/traversing.js'; |
| import * as Manipulation from './api/manipulation.js'; |
| import * as Css from './api/css.js'; |
| import * as Forms from './api/forms.js'; |
| import * as Extract from './api/extract.js'; |
|
|
| type MethodsType = typeof Attributes & |
| typeof Traversing & |
| typeof Manipulation & |
| typeof Css & |
| typeof Forms & |
| typeof Extract; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| export abstract class Cheerio<T> implements ArrayLike<T> { |
| length = 0; |
| [index: number]: T; |
|
|
| options: InternalOptions; |
| |
| |
| |
| |
| |
| |
| _root: Cheerio<Document> | null; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| constructor( |
| elements: ArrayLike<T> | undefined, |
| root: Cheerio<Document> | null, |
| options: InternalOptions, |
| ) { |
| this.options = options; |
| this._root = root; |
|
|
| if (elements) { |
| for (let idx = 0; idx < elements.length; idx++) { |
| this[idx] = elements[idx]; |
| } |
| this.length = elements.length; |
| } |
| } |
|
|
| prevObject: Cheerio<any> | undefined; |
| |
| |
| |
| |
| |
| |
| |
| |
| abstract _make<T>( |
| dom: ArrayLike<T> | T | string, |
| context?: BasicAcceptedElems<AnyNode>, |
| ): Cheerio<T>; |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| abstract _parse( |
| content: string | Document | AnyNode | AnyNode[] | Buffer, |
| options: InternalOptions, |
| isDocument: boolean, |
| context: ParentNode | null, |
| ): Document; |
|
|
| |
| |
| |
| |
| |
| |
| |
| abstract _render(dom: AnyNode | ArrayLike<AnyNode>): string; |
| } |
|
|
| export interface Cheerio<T> extends MethodsType, Iterable<T> { |
| cheerio: '[cheerio object]'; |
|
|
| splice: typeof Array.prototype.splice; |
| } |
|
|
| |
| Cheerio.prototype.cheerio = '[cheerio object]'; |
|
|
| |
| |
| |
| Cheerio.prototype.splice = Array.prototype.splice; |
|
|
| |
| Cheerio.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; |
|
|
| |
| Object.assign( |
| Cheerio.prototype, |
| Attributes, |
| Traversing, |
| Manipulation, |
| Css, |
| Forms, |
| Extract, |
| ); |
|
|