Skip to content

Commit

Permalink
feat: Make it possible to specify custom selectors
Browse files Browse the repository at this point in the history
Fixes #1186
  • Loading branch information
fb55 committed Aug 14, 2021
1 parent efcba05 commit 0302810
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/index.ts
Expand Up @@ -63,6 +63,26 @@ export const load = getLoad(parse, (dom, options) =>
*/
export default load([]);

import { filters, pseudos, aliases } from 'cheerio-select';

/**
* Extension points for adding custom pseudo selectors.
*
* @example <caption>Adds a custom pseudo selector `:classic`, which matches
* some fun HTML elements that are no more.</caption>
*
* ```js
* import { load, select } from 'cheerio';
*
* // Aliases are short hands for longer HTML selectors
* select.aliases.classic = 'marquee,blink';
*
* const $ = load(doc);
* $(':classic').html();
* ```
*/
export const select = { filters, pseudos, aliases };

import * as staticMethods from './static';

/**
Expand Down

0 comments on commit 0302810

Please sign in to comment.