lib/capybara/poltergeist/client/compiled/agent.js in poltergeist-0.3.0 vs lib/capybara/poltergeist/client/compiled/agent.js in poltergeist-0.4.0

- old
+ new

@@ -175,26 +175,16 @@ } else { return true; } }; Node.prototype.position = function() { - var pos; - pos = function(element) { - var parentPos, x, y; - x = element.offsetLeft; - y = element.offsetTop; - if (element.offsetParent) { - parentPos = pos(element.offsetParent); - x += parentPos.x; - y += parentPos.y; - } - return { - x: x, - y: y - }; + var rect; + rect = this.element.getBoundingClientRect(); + return { + top: rect.top, + left: rect.left }; - return pos(this.element); }; Node.prototype.trigger = function(name) { var event; if (Node.EVENTS.MOUSE.indexOf(name) !== -1) { event = document.createEvent('MouseEvent'); @@ -210,6 +200,12 @@ return Node; })(); window.__poltergeist = new PoltergeistAgent; document.addEventListener('DOMContentLoaded', function() { return console.log('__DOMContentLoaded'); -}); +}); +window.confirm = function(message) { + return true; +}; +window.prompt = function(message, _default) { + return _default || null; +}; \ No newline at end of file