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
5cae50e6
Commit
5cae50e6
authored
Feb 25, 2012
by
Mike Sherov
Committed by
Dave Methvin
Mar 02, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #3838, $(document).height() incorrect in IE6
May still be broken in Netscape Navigator 4.
parent
da02e190
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
1 deletion
+51
-1
dimensions.js
src/dimensions.js
+9
-1
documentLarge.html
test/data/dimensions/documentLarge.html
+17
-0
documentSmall.html
test/data/dimensions/documentSmall.html
+11
-0
dimensions.js
test/unit/dimensions.js
+14
-0
No files found.
src/dimensions.js
View file @
5cae50e6
...
@@ -42,8 +42,16 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
...
@@ -42,8 +42,16 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
if
(
elem
.
nodeType
===
9
)
{
if
(
elem
.
nodeType
===
9
)
{
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
doc
=
elem
.
documentElement
;
doc
=
elem
.
documentElement
;
// when a window > document, IE6 reports a offset[Width/Height] > client[Width/Height]
// so we can't use max, as it'll choose the incorrect offset[Width/Height]
// instead we use the correct client[Width/Height]
// support:IE6
if
(
doc
[
clientProp
]
>=
doc
[
scrollProp
]
)
{
return
doc
[
clientProp
];
}
return
Math
.
max
(
return
Math
.
max
(
doc
[
clientProp
],
elem
.
body
[
scrollProp
],
doc
[
scrollProp
],
elem
.
body
[
scrollProp
],
doc
[
scrollProp
],
elem
.
body
[
offsetProp
],
doc
[
offsetProp
]
elem
.
body
[
offsetProp
],
doc
[
offsetProp
]
);
);
...
...
test/data/dimensions/documentLarge.html
0 → 100644
View file @
5cae50e6
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xml:lang=
"en"
lang=
"en"
dir=
"ltr"
id=
"html"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<style>
body
{
width
:
1000px
;
height
:
1000px
;
}
</style>
</head>
<body>
<div>
<script
src=
"../include_js.php"
></script>
</div>
</body>
</html>
\ No newline at end of file
test/data/dimensions/documentSmall.html
0 → 100644
View file @
5cae50e6
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xml:lang=
"en"
lang=
"en"
dir=
"ltr"
id=
"html"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
</head>
<body>
<div>
<script
src=
"../include_js.php"
></script>
</div>
</body>
</html>
\ No newline at end of file
test/unit/dimensions.js
View file @
5cae50e6
...
@@ -315,3 +315,17 @@ test("outerHeight()", function() {
...
@@ -315,3 +315,17 @@ test("outerHeight()", function() {
div
.
remove
();
div
.
remove
();
jQuery
.
removeData
(
$div
[
0
],
"olddisplay"
,
true
);
jQuery
.
removeData
(
$div
[
0
],
"olddisplay"
,
true
);
});
});
testIframe
(
"dimensions/documentSmall"
,
"window vs. small document"
,
function
(
jQuery
,
window
,
document
)
{
expect
(
2
);
equal
(
jQuery
(
document
).
height
(),
jQuery
(
window
).
height
(),
"document height matches window height"
);
equal
(
jQuery
(
document
).
width
(),
jQuery
(
window
).
width
(),
"document width matches window width"
);
});
testIframe
(
"dimensions/documentLarge"
,
"window vs. large document"
,
function
(
jQuery
,
window
,
document
)
{
expect
(
2
);
ok
(
jQuery
(
document
).
height
()
>
jQuery
(
window
).
height
(),
"document height is larger than window height"
);
ok
(
jQuery
(
document
).
width
()
>
jQuery
(
window
).
width
(),
"document width is larger than window width"
);
});
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