diff options
Diffstat (limited to 'src/utils.mjs')
-rw-r--r-- | src/utils.mjs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/utils.mjs b/src/utils.mjs index d2c5d8f..c0da23a 100644 --- a/src/utils.mjs +++ b/src/utils.mjs | |||
@@ -173,7 +173,7 @@ export const replaceTextNodes = ( | |||
173 | const nodeIterator = document.createNodeIterator( | 173 | const nodeIterator = document.createNodeIterator( |
174 | rootNode, | 174 | rootNode, |
175 | window.NodeFilter.SHOW_TEXT, | 175 | window.NodeFilter.SHOW_TEXT, |
176 | node => node.textContent.match(pattern) && !node.parentElement.closest('pre,code,a') | 176 | node => node.textContent.match(pattern) && node.parentElement && !node.parentElement.closest('pre,code,a') |
177 | ? window.NodeFilter.FILTER_ACCEPT | 177 | ? window.NodeFilter.FILTER_ACCEPT |
178 | : window.NodeFilter.FILTER_REJECT, | 178 | : window.NodeFilter.FILTER_REJECT, |
179 | ) | 179 | ) |