Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct createNodeIterator api #21

Merged
merged 2 commits into from
Apr 14, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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