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
a52391aa
Commit
a52391aa
authored
Feb 24, 2012
by
Mike Sherov
Committed by
Dave Methvin
Feb 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #7986. $.support.boxModel shan't be fooled by page-level CSS.
parent
1c35f381
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
18 deletions
+34
-18
css.js
src/css.js
+1
-1
dimensions.js
src/dimensions.js
+1
-1
effects.js
src/effects.js
+2
-2
support.js
src/support.js
+23
-14
bodyBackground.html
test/data/support/bodyBackground.html
+7
-0
No files found.
src/css.js
View file @
a52391aa
...
...
@@ -163,7 +163,7 @@ jQuery.extend({
}
});
// DEPRECATED, Use jQuery.css() instead
// DEPRECATED
in 1.3
, Use jQuery.css() instead
jQuery
.
curCSS
=
jQuery
.
css
;
if
(
document
.
defaultView
&&
document
.
defaultView
.
getComputedStyle
)
{
...
...
src/dimensions.js
View file @
a52391aa
...
...
@@ -34,7 +34,7 @@ jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
doc
=
elem
.
document
;
docElemProp
=
doc
.
documentElement
[
clientProp
];
return
doc
.
compatMode
===
"CSS1Compat"
&&
docElemProp
||
return
jQuery
.
support
.
boxModel
&&
docElemProp
||
doc
.
body
&&
doc
.
body
[
clientProp
]
||
docElemProp
;
}
...
...
src/effects.js
View file @
a52391aa
...
...
@@ -157,7 +157,7 @@ jQuery.fn.extend({
prop
[
name
]
=
prop
[
p
];
delete
prop
[
p
];
}
if
(
(
hooks
=
jQuery
.
cssHooks
[
name
]
)
&&
"expand"
in
hooks
)
{
replace
=
hooks
.
expand
(
prop
[
name
]
);
delete
prop
[
name
];
...
...
@@ -676,7 +676,7 @@ function defaultDisplay( nodeName ) {
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if
(
!
iframeDoc
||
!
iframe
.
createElement
)
{
iframeDoc
=
(
iframe
.
contentWindow
||
iframe
.
contentDocument
).
document
;
iframeDoc
.
write
(
(
document
.
compatMode
===
"CSS1Compat"
?
"<!doctype html>"
:
""
)
+
"<html><body>"
);
iframeDoc
.
write
(
(
jQuery
.
support
.
boxModel
?
"<!doctype html>"
:
""
)
+
"<html><body>"
);
iframeDoc
.
close
();
}
...
...
src/support.js
View file @
a52391aa
...
...
@@ -94,6 +94,9 @@ jQuery.support = (function() {
pixelMargin
:
true
};
//jQuery.boxModel DEPRECATED in 1.3, use jQuery.support.boxModel instead
jQuery
.
boxModel
=
support
.
boxModel
=
document
.
compatMode
===
"CSS1Compat"
;
// Make sure checked status is properly cloned
input
.
checked
=
true
;
support
.
noCloneChecked
=
input
.
cloneNode
(
true
).
checked
;
...
...
@@ -172,7 +175,8 @@ jQuery.support = (function() {
// Run tests that need a body at doc ready
jQuery
(
function
()
{
var
container
,
outer
,
inner
,
table
,
td
,
offsetSupport
,
marginDiv
,
conMarginTop
,
ptlm
,
vb
,
style
,
html
,
marginDiv
,
conMarginTop
,
style
,
html
,
positionTopLeftWidthHeight
,
paddingMarginBorderVisibility
,
paddingMarginBorder
,
body
=
document
.
getElementsByTagName
(
"body"
)[
0
];
if
(
!
body
)
{
...
...
@@ -181,15 +185,16 @@ jQuery.support = (function() {
}
conMarginTop
=
1
;
ptlm
=
"position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"
;
vb
=
"visibility:hidden;border:0;"
;
style
=
"style='"
+
ptlm
+
"border:5px solid #000;padding:0;'"
;
html
=
"<div "
+
style
+
"><div></div></div>"
+
"<table "
+
style
+
" cellpadding='0' cellspacing='0'>"
+
paddingMarginBorder
=
"padding:0;margin:0;border:"
;
positionTopLeftWidthHeight
=
"position:absolute;top:0;left:0;width:1px;height:1px;"
;
paddingMarginBorderVisibility
=
paddingMarginBorder
+
"0;visibility:hidden;"
;
style
=
"style='"
+
positionTopLeftWidthHeight
+
paddingMarginBorder
+
"5px solid #000;"
;
html
=
"<div "
+
style
+
"display:block;'><div style='"
+
paddingMarginBorder
+
"0;display:block;overflow:hidden;'></div></div>"
+
"<table "
+
style
+
"' cellpadding='0' cellspacing='0'>"
+
"<tr><td></td></tr></table>"
;
container
=
document
.
createElement
(
"div"
);
container
.
style
.
cssText
=
vb
+
"width:0;height:0;position:static;top:0;margin-top:"
+
conMarginTop
+
"px"
;
container
.
style
.
cssText
=
paddingMarginBorderVisibility
+
"width:0;height:0;position:static;top:0;margin-top:"
+
conMarginTop
+
"px"
;
body
.
insertBefore
(
container
,
body
.
firstChild
);
// Construct the test element
...
...
@@ -203,8 +208,7 @@ jQuery.support = (function() {
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div
.
innerHTML
=
"<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>"
;
div
.
innerHTML
=
"<table><tr><td style='"
+
paddingMarginBorder
+
"0;display:none'></td><td>t</td></tr></table>"
;
tds
=
div
.
getElementsByTagName
(
"td"
);
isSupported
=
(
tds
[
0
].
offsetHeight
===
0
);
...
...
@@ -241,18 +245,23 @@ jQuery.support = (function() {
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div
.
innerHTML
=
""
;
div
.
style
.
width
=
div
.
style
.
padding
=
"1px"
;
div
.
style
.
border
=
0
;
div
.
style
.
overflow
=
"hidden"
;
div
.
style
.
display
=
"inline"
;
div
.
style
.
zoom
=
1
;
support
.
inlineBlockNeedsLayout
=
(
div
.
offsetWidth
===
2
);
support
.
inlineBlockNeedsLayout
=
(
div
.
offsetWidth
===
3
);
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div
.
style
.
display
=
""
;
div
.
innerHTML
=
"<div style='width:4px;'></div>"
;
support
.
shrinkWrapBlocks
=
(
div
.
offsetWidth
!==
2
);
div
.
style
.
display
=
"block"
;
div
.
style
.
overflow
=
"visible"
;
div
.
innerHTML
=
"<div style='width:5px;'></div>"
;
support
.
shrinkWrapBlocks
=
(
div
.
offsetWidth
!==
3
);
}
div
.
style
.
cssText
=
p
tlm
+
vb
;
div
.
style
.
cssText
=
p
ositionTopLeftWidthHeight
+
paddingMarginBorderVisibility
;
div
.
innerHTML
=
html
;
outer
=
div
.
firstChild
;
...
...
test/data/support/bodyBackground.html
View file @
a52391aa
...
...
@@ -6,6 +6,13 @@
body
{
background
:
#000000
;
}
div
{
padding
:
15px
;
border
:
1px
solid
#999
;
display
:
inline
;
margin
:
8px
;
}
</style>
</head>
<body>
...
...
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