lib/capybara/poltergeist/client/agent.coffee in poltergeist-1.12.0 vs lib/capybara/poltergeist/client/agent.coffee in poltergeist-1.13.0

- old
+ new

@@ -53,11 +53,11 @@ afterUpload: (id) -> this.get(id).removeAttribute('_poltergeist_selected') clearLocalStorage: -> - localStorage.clear() + localStorage?.clear() class PoltergeistAgent.ObsoleteNode toString: -> "PoltergeistAgent.ObsoleteNode" class PoltergeistAgent.InvalidSelector @@ -264,10 +264,15 @@ rect.left >= 0 && rect.bottom <= window.innerHeight && rect.right <= window.innerWidth isDisabled: -> - @element.disabled || @element.tagName == 'OPTION' && @element.parentNode.disabled + xpath = 'parent::optgroup[@disabled] | \ + ancestor::select[@disabled] | \ + parent::fieldset[@disabled] | \ + ancestor::*[not(self::legend) or preceding-sibling::legend][parent::fieldset[@disabled]]' + + @element.disabled || document.evaluate(xpath, @element, null, XPathResult.BOOLEAN_TYPE, null).booleanValue path: -> elements = @parentIds().reverse().map((id) => @agent.get(id)) elements.push(this) selectors = elements.map (el)->