Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
6df39907
Commit
6df39907
authored
Jun 16, 2015
by
Timmy Willison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Offset: revert to jQuery.contains for IE8's sake (compat only)
- getClientRects() throws on disconnected elements in IE8 only
parent
25e8620d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
offset.js
src/offset.js
+10
-7
No files found.
src/offset.js
View file @
6df39907
...
...
@@ -88,17 +88,22 @@ jQuery.fn.extend({
});
}
var
docElem
,
win
,
rect
,
doc
,
elem
=
this
[
0
];
var
docElem
,
win
,
rect
,
elem
=
this
[
0
],
doc
=
elem
&&
elem
.
ownerDocument
;
if
(
!
elem
)
{
if
(
!
doc
)
{
return
;
}
docElem
=
doc
.
documentElement
;
// Support: IE<=11+
// Running getBoundingClientRect on a
// disconnected node in IE throws an error
if
(
!
elem
.
getClientRects
().
length
)
{
// Support: IE8 only
// getClientRects() errors on disconnected elems
if
(
!
jQuery
.
contains
(
docElem
,
elem
)
)
{
return
{
top
:
0
,
left
:
0
};
}
...
...
@@ -106,9 +111,7 @@ jQuery.fn.extend({
// Make sure element is not hidden (display: none)
if
(
rect
.
width
||
rect
.
height
)
{
doc
=
elem
.
ownerDocument
;
win
=
getWindow
(
doc
);
docElem
=
doc
.
documentElement
;
return
{
top
:
rect
.
top
+
(
win
.
pageYOffset
||
docElem
.
scrollTop
)
-
...
...
@@ -118,7 +121,7 @@ jQuery.fn.extend({
};
}
// Return zeros for
disconnected and hidden elements (gh-2310)
// Return zeros for
hidden elements
return
rect
;
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment