Skip to content

Commit

Permalink
Merge pull request madrobby#1069 from thiagopnts/master
Browse files Browse the repository at this point in the history
Fix error in offset call on IE10
  • Loading branch information
mislav committed Jan 29, 2015
2 parents 08230d8 + d920bee commit a9184b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/zepto.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,8 @@ var Zepto = (function() {
$this.css(props)
})
if (!this.length) return null
if (!$.contains(document.documentElement, this[0]))
return {top: 0, left: 0}
var obj = this[0].getBoundingClientRect()
return {
left: obj.left + window.pageXOffset,
Expand Down
1 change: 1 addition & 0 deletions test/zepto.html
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,7 @@ <h1>Zepto Core unit tests</h1>
t.assertNull($('#doesnotexist').offset())
var el = $('#some_element')
t.assertIdentical(el, el.offset({}))
t.assertSame($('<div>').offset(), {left: 0, top: 0})
},

testWidth: function(t){
Expand Down

0 comments on commit a9184b2

Please sign in to comment.