Skip to content

Commit

Permalink
perf: replace ignoreDOMNode with ignoreDomNode
Browse files Browse the repository at this point in the history
The new TRE engine uses a custom parser to support this callback.
Therefore, a supplementary tree traversal after parsing is not required
anymore, removing a O(n) computational cost.

BREAKING CHANGE: `ignoreDOMNode` is now `ignoreDomNode` for naming
consistency.
  • Loading branch information
jsamr committed Jun 4, 2021
1 parent e961942 commit 9ec6403
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions packages/render-html/src/shared-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,20 +350,13 @@ export interface TransientRenderEngineConfig {
/**
* Ignore specific DOM nodes.
*
* @remarks Use `ignoredTags` if you simply need to discard specific tags.
*
* @param node - The DOM node to check.
* @returns `true` if the node should be dropped, `false` otherwise.
*/
ignoreDOMNode?: (node: DOMNode) => boolean;
/**
* Change the data of specific DOM text nodes.
*
* @param textNode - The DOM text node to check.
* @returns A string if the node data should be altered, `false` or `void`
* otherwise.
* @remarks
* - Use `ignoredDomTags` if you just need to target specific tag names.
* - The function is applied during DOM parsing, thus with very little
* overhead. However, it means that one node next siblings won't be
* available since it has not yet been parsed.
*/
alterDOMData?: (textNode: DOMText) => string | false | void;
ignoreDomNode?: (node: DOMNode) => boolean;
/**
* Change specific DOM nodes children.
*
Expand Down

0 comments on commit 9ec6403

Please sign in to comment.