lib/capybara/poltergeist/client/compiled/agent.js in poltergeist-1.8.0 vs lib/capybara/poltergeist/client/compiled/agent.js in poltergeist-1.8.1

- old
+ new

@@ -184,15 +184,16 @@ Node.prototype.isObsolete = function() { var obsolete; obsolete = (function(_this) { return function(element) { - if (element.parentNode != null) { - if (element.parentNode === document) { + var parent; + if ((parent = element.parentNode) != null) { + if (parent === document) { return false; } else { - return obsolete(element.parentNode); + return obsolete(parent); } } else { return true; } }; @@ -379,11 +380,13 @@ return this.element.tagName; }; Node.prototype.isVisible = function(element) { var style; - element || (element = this.element); + if (element == null) { + element = this.element; + } while (element) { style = window.getComputedStyle(element); if (style.display === 'none' || style.visibility === 'hidden' || parseFloat(style.opacity) === 0) { return false; } @@ -447,10 +450,10 @@ return offset; }; Node.prototype.position = function() { var frameOffset, pos, rect; - rect = this.element.getClientRects()[0]; + rect = this.element.getClientRects()[0] || this.element.getBoundingClientRect(); if (!rect) { throw new PoltergeistAgent.ObsoleteNode; } frameOffset = this.frameOffset(); pos = {