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
aaf134bb
Commit
aaf134bb
authored
Jul 06, 2012
by
Nowres Rafid
Committed by
Dave Methvin
Jul 06, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #8482, offsetParent should not return null. Closes gh-847.
parent
05aff402
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
offset.js
src/offset.js
+1
-1
index.html
test/index.html
+3
-0
offset.js
test/unit/offset.js
+4
-1
No files found.
src/offset.js
View file @
aaf134bb
...
@@ -138,7 +138,7 @@ jQuery.fn.extend({
...
@@ -138,7 +138,7 @@ jQuery.fn.extend({
while
(
offsetParent
&&
(
!
rroot
.
test
(
offsetParent
.
nodeName
)
&&
jQuery
.
css
(
offsetParent
,
"position"
)
===
"static"
)
)
{
while
(
offsetParent
&&
(
!
rroot
.
test
(
offsetParent
.
nodeName
)
&&
jQuery
.
css
(
offsetParent
,
"position"
)
===
"static"
)
)
{
offsetParent
=
offsetParent
.
offsetParent
;
offsetParent
=
offsetParent
.
offsetParent
;
}
}
return
offsetParent
;
return
offsetParent
||
document
.
body
;
});
});
}
}
});
});
...
...
test/index.html
View file @
aaf134bb
...
@@ -305,6 +305,9 @@ Z</textarea>
...
@@ -305,6 +305,9 @@ Z</textarea>
<div
id=
"fx-tests"
></div>
<div
id=
"fx-tests"
></div>
</div>
</div>
<map
name=
"imgmap"
id=
"imgmap"
>
<area
shape=
"rect"
coords=
"0,0,200,50"
>
</map>
</body>
</body>
</html>
</html>
test/unit/offset.js
View file @
aaf134bb
...
@@ -440,7 +440,7 @@ test("chaining", function() {
...
@@ -440,7 +440,7 @@ test("chaining", function() {
});
});
test
(
"offsetParent"
,
function
(){
test
(
"offsetParent"
,
function
(){
expect
(
1
1
);
expect
(
1
2
);
var
body
=
jQuery
(
"body"
).
offsetParent
();
var
body
=
jQuery
(
"body"
).
offsetParent
();
equal
(
body
.
length
,
1
,
"Only one offsetParent found."
);
equal
(
body
.
length
,
1
,
"Only one offsetParent found."
);
...
@@ -464,6 +464,9 @@ test("offsetParent", function(){
...
@@ -464,6 +464,9 @@ test("offsetParent", function(){
equal
(
div
.
length
,
2
,
"Two offsetParent found."
);
equal
(
div
.
length
,
2
,
"Two offsetParent found."
);
equal
(
div
[
0
],
document
.
body
,
"The body is the offsetParent."
);
equal
(
div
[
0
],
document
.
body
,
"The body is the offsetParent."
);
equal
(
div
[
1
],
jQuery
(
"#nothiddendiv"
)[
0
],
"The div is the offsetParent."
);
equal
(
div
[
1
],
jQuery
(
"#nothiddendiv"
)[
0
],
"The div is the offsetParent."
);
var
area
=
jQuery
(
"#imgmap area"
).
offsetParent
();
equal
(
area
[
0
],
document
.
body
,
"The body is the offsetParent."
);
});
});
test
(
"fractions (see #7730 and #7885)"
,
function
()
{
test
(
"fractions (see #7730 and #7885)"
,
function
()
{
...
...
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