lib/capybara/poltergeist/client/agent.coffee in poltergeist-1.3.0 vs lib/capybara/poltergeist/client/agent.coffee in poltergeist-1.4.0
- old
+ new
@@ -23,11 +23,11 @@
'"(cyclic structure)"'
else
throw error
currentUrl: ->
- window.location.toString()
+ encodeURI(window.location.href)
find: (method, selector, within = document) ->
try
if method == "xpath"
xpath = document.evaluate(selector, within, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
@@ -212,14 +212,15 @@
frameOffset: ->
win = window
offset = { top: 0, left: 0 }
while win.frameElement
- rect = window.frameElement.getClientRects()[0]
- win = win.parent
-
- offset.top += rect.top
- offset.left += rect.left
+ rect = win.frameElement.getClientRects()[0]
+ style = win.getComputedStyle(win.frameElement)
+ win = win.parent
+
+ offset.top += rect.top + parseInt(style.getPropertyValue("padding-top"), 10)
+ offset.left += rect.left + parseInt(style.getPropertyValue("padding-left"), 10)
offset
position: ->
rect = @element.getClientRects()[0]