Constructor
new Filter(rules, parser)
Creates new filter's instance.
Parameters:
Name | Type | Description |
---|---|---|
rules |
String | Array.<String> | Rules passed as a string or an array of strings. |
parser |
RuleParser | Object | Rules' syntax to CSS parser. |
Methods
addRule(rule, disableReparseopt) → {undefined}
Add given rule to the current's filter instance.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
rule |
String | Rule to be added. | ||
disableReparse |
Boolean |
<optional> |
false
|
Indicates if reparsing the rules should be forbidden. |
Returns:
- Type
- undefined
addRules(rules) → {undefined}
Add given rules to the current's filter instance.
Parameters:
Name | Type | Description |
---|---|---|
rules |
Array.<String> | Rules to be added. |
Returns:
- Type
- undefined
filter(input) → {FilteredDocumentFragment}
Filters given HTML string/DocumentFragment using CSS selectors.
Parameters:
Name | Type | Description |
---|---|---|
input |
DocumentFragment | HTMLElement | String | DocumentFragment will be constructed from this parameter. |
Returns:
Filtered DocumentFragment.