Merge pull request #1343 from glacambre/fix_1340

Fix #1340
This commit is contained in:
Oliver Blanthorn 2019-02-09 16:06:39 +00:00 committed by GitHub
commit b4efcd1a8c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -65,7 +65,8 @@ export function getMatches(findings, contextLength = 10): Match[] {
!firstnode ||
!lastnode ||
isCommandLineNode(firstnode) ||
isCommandLineNode(lastnode)
isCommandLineNode(lastnode) ||
!DOM.isVisible(firstnode)
)
continue

View file

@ -217,6 +217,9 @@ export function widthMatters(style: CSSStyleDeclaration) {
*/
export function isVisible(element: Element) {
while (!(element.getClientRects instanceof Function)) {
element = element.parentElement
}
const clientRect = element.getClientRects()[0]
const computedStyle = getComputedStyle(element)
// remove elements that are barely within the viewport, tiny, or invisible