Skip to content

Commit

Permalink
Merge pull request #21 from github/use-correct-create-node-iterator-api
Browse files Browse the repository at this point in the history
Use correct createNodeIterator api
  • Loading branch information
koddsson authored Apr 14, 2020
2 parents c59d49a + 4c7a595 commit e53342a
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,14 @@ for (let level = 2; level <= 6; ++level) {
}

export function insertMarkdownSyntax(root: DocumentFragment): void {
// eslint-disable-next-line @typescript-eslint/ban-ts-ignore
// @ts-ignore
const nodeIterator = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, function (node: Node) {
if (node.nodeName in filters && !skipNode(node) && (hasContent(node) || isCheckbox(node))) {
return NodeFilter.FILTER_ACCEPT
}
const nodeIterator = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, {
acceptNode(node: Node) {
if (node.nodeName in filters && !skipNode(node) && (hasContent(node) || isCheckbox(node))) {
return NodeFilter.FILTER_ACCEPT
}

return NodeFilter.FILTER_SKIP
return NodeFilter.FILTER_SKIP
}
})
const results: HTMLElement[] = []
let node = nodeIterator.nextNode()
Expand Down

0 comments on commit e53342a

Please sign in to comment.