We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 373a08e commit 5376351Copy full SHA for 5376351
src/paste-markdown-html.ts
@@ -136,8 +136,8 @@ function isChildOfSupportedMarkdownNode({parentNode}: Node): boolean {
136
}
137
138
/** NodeIterator is not iterable, so this wrapper makes it usable in `for...of` loops. */
139
-function* iterateNodes(document: Document, whatToShow?: number, filter?: NodeFilter | null) {
140
- const iterator = document.createNodeIterator(document.body, whatToShow, filter)
+function* iterateNodes(root: Node, whatToShow?: number, filter?: NodeFilter | null) {
+ const iterator = (root.ownerDocument ?? document).createNodeIterator(root, whatToShow, filter)
141
142
let node
143
while ((node = iterator.nextNode())) yield node
0 commit comments