lib/capybara/poltergeist/client/compiled/node.js in poltergeist-0.1.0 vs lib/capybara/poltergeist/client/compiled/node.js in poltergeist-0.2.0
- old
+ new
@@ -27,24 +27,25 @@
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
name = _ref[_i];
_fn(name);
}
Node.prototype.scrollIntoView = function() {
- var pos, scroll, size, viewport, _ref2, _ref3;
- viewport = this.page.viewport();
- size = this.page.documentSize();
+ var dimensions, document, pos, scroll, viewport, _ref2, _ref3;
+ dimensions = this.page.validatedDimensions();
+ document = dimensions.document;
+ viewport = dimensions.viewport;
pos = this.position();
scroll = {
- left: viewport.left,
- top: viewport.top
+ left: dimensions.left,
+ top: dimensions.top
};
- if (!((viewport.left <= (_ref2 = pos.x) && _ref2 < viewport.right))) {
- scroll.left = Math.min(pos.x, size.width - viewport.width);
+ if (!((dimensions.left <= (_ref2 = pos.x) && _ref2 < dimensions.right))) {
+ scroll.left = Math.min(pos.x, document.width - viewport.width);
}
- if (!((viewport.top <= (_ref3 = pos.y) && _ref3 < viewport.bottom))) {
- scroll.top = Math.min(pos.y, size.height - viewport.height);
+ if (!((dimensions.top <= (_ref3 = pos.y) && _ref3 < dimensions.bottom))) {
+ scroll.top = Math.min(pos.y, document.height - viewport.height);
}
- if (scroll.left !== viewport.left || scroll.top !== viewport.top) {
+ if (scroll.left !== dimensions.left || scroll.top !== dimensions.top) {
this.page.setScrollPosition(scroll);
}
return {
position: this.relativePosition(pos, scroll),
scroll: scroll
\ No newline at end of file