Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Commit

Permalink
Fix crash in ignoreElements
Browse files Browse the repository at this point in the history
Was broken during client scripts refactoring
  • Loading branch information
Sergey Tatarintsev committed Mar 3, 2015
1 parent 94dc574 commit b09b4aa
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions lib/browser/client-scripts/gemini.js
Expand Up @@ -138,9 +138,7 @@
left: getScrollLeft()
},
captureArea: rect,
ignoreAreas: opts.ignoreSelectors.map(function(selector) {
return getElementCaptureRect(selector);
}),
ignoreAreas: findIgnoreAreas(opts.ignoreSelectors),
viewportHeight: Math.round(viewportHeight),
bodyHeight: Math.round(bodyHeight),
coverage: coverage,
Expand Down Expand Up @@ -168,6 +166,17 @@
return rect && rect.round();
}

function findIgnoreAreas(selectors) {
var result = [];
each(selectors, function(selector) {
var element = document.querySelector(selector);
if (element) {
result.push(getElementCaptureRect(element).round());
}
});
return result;
}

exports.getAbsoluteClientRect = function getAbsoluteClientRect(element) {
var clientRect = new Rect(element.getBoundingClientRect());
return clientRect.translate(getScrollLeft(), getScrollTop());
Expand Down

0 comments on commit b09b4aa

Please sign in to comment.