@@ -99,7 +99,7 @@ _//TODO: More in-depth description. Implementation details. Build a spaceship._
9999## API
100100
101101``` js
102- const CSSselect = require ( " css-select" ) ;
102+ import * as CSSselect from " css-select" ;
103103```
104104
105105** Note:** css-select throws errors when invalid selectors are passed to it. This
@@ -112,10 +112,11 @@ Queries `elems`, returns an array containing all matches.
112112
113113- ` query ` can be either a CSS selector or a function.
114114- ` elems ` can be either an array of elements, or a single element. If it is an
115- element, its children will be queried.
115+ element, its children will be queried. ** Note:** when passing an array, it may
116+ be mutated (elements that are subsets of other elements will be removed).
116117- ` options ` is described below.
117118
118- Aliases : ` default ` export, ` CSSselect.iterate(query, elems) ` .
119+ Alias : ` default ` export.
119120
120121#### ` CSSselect.compile(query, options) `
121122
@@ -156,8 +157,11 @@ All options are optional.
156157
157158#### Custom Adapters
158159
159- A custom adapter must match the interface described
160- [ here] ( https://github.com/fb55/css-select/blob/1aa44bdd64aaf2ebdfd7f338e2e76bed36521957/src/types.ts#L6-L96 ) .
160+ A custom adapter must match the
161+ [ ` Adapter ` interface] ( https://github.com/fb55/css-select/blob/master/src/types.ts ) .
162+ Tree traversal (` findAll ` /` findOne ` ) is handled internally by css-select using
163+ the adapter's primitive methods, so adapters only need to implement basic
164+ operations like ` isTag ` , ` getChildren ` , ` getParent ` , etc.
161165
162166You may want to have a look at [ ` domutils ` ] ( https://github.com/fb55/domutils ) to
163167see the default implementation, or at
0 commit comments