fix(text selector): ignore NOSCRIPT elements (#15887)

These are usually not rendered, and some sites have very big content inside,
for example full page markup.
This commit is contained in:
Dmitry Gozman 2022-07-22 16:18:06 -07:00 committed by GitHub
parent 92d65ab3e7
commit fd21852b01
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,7 +76,7 @@ export function createRegexTextMatcher(source: string, flags?: string): TextMatc
}
export function shouldSkipForTextMatching(element: Element | ShadowRoot) {
return element.nodeName === 'SCRIPT' || element.nodeName === 'STYLE' || document.head && document.head.contains(element);
return element.nodeName === 'SCRIPT' || element.nodeName === 'NOSCRIPT' || element.nodeName === 'STYLE' || document.head && document.head.contains(element);
}
export type ElementText = { full: string, immediate: string[] };