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
1912ded3
Commit
1912ded3
authored
Mar 24, 2011
by
jeresig
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bug-3333' of
https://github.com/rdworth/jquery
into rdworth-bug-3333
parents
7705c35b
c3c507e9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletion
+44
-1
css.js
src/css.js
+19
-0
support.js
src/support.js
+13
-1
css.js
test/unit/css.js
+12
-0
No files found.
src/css.js
View file @
1912ded3
...
@@ -240,6 +240,25 @@ if ( !jQuery.support.opacity ) {
...
@@ -240,6 +240,25 @@ if ( !jQuery.support.opacity ) {
};
};
}
}
jQuery
(
function
()
{
// This hook cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
if
(
!
jQuery
.
support
.
reliableMarginRight
)
{
jQuery
.
cssHooks
.
marginRight
=
{
get
:
function
(
elem
,
computed
)
{
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
var
ret
=
"0px"
,
display
=
elem
.
style
.
display
;
elem
.
style
.
display
=
"inline-block"
;
ret
=
getComputedStyle
(
elem
,
"margin-right"
,
"margin-right"
);
elem
.
style
.
display
=
display
;
return
ret
;
}
}
}
});
if
(
document
.
defaultView
&&
document
.
defaultView
.
getComputedStyle
)
{
if
(
document
.
defaultView
&&
document
.
defaultView
.
getComputedStyle
)
{
getComputedStyle
=
function
(
elem
,
newName
,
name
)
{
getComputedStyle
=
function
(
elem
,
newName
,
name
)
{
var
ret
,
defaultView
,
computedStyle
;
var
ret
,
defaultView
,
computedStyle
;
...
...
src/support.js
View file @
1912ded3
...
@@ -67,7 +67,8 @@
...
@@ -67,7 +67,8 @@
boxModel
:
null
,
boxModel
:
null
,
inlineBlockNeedsLayout
:
false
,
inlineBlockNeedsLayout
:
false
,
shrinkWrapBlocks
:
false
,
shrinkWrapBlocks
:
false
,
reliableHiddenOffsets
:
true
reliableHiddenOffsets
:
true
,
reliableMarginRight
:
true
};
};
input
.
checked
=
true
;
input
.
checked
=
true
;
...
@@ -188,6 +189,17 @@
...
@@ -188,6 +189,17 @@
jQuery
.
support
.
reliableHiddenOffsets
=
jQuery
.
support
.
reliableHiddenOffsets
&&
tds
[
0
].
offsetHeight
===
0
;
jQuery
.
support
.
reliableHiddenOffsets
=
jQuery
.
support
.
reliableHiddenOffsets
&&
tds
[
0
].
offsetHeight
===
0
;
div
.
innerHTML
=
""
;
div
.
innerHTML
=
""
;
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if
(
document
.
defaultView
&&
document
.
defaultView
.
getComputedStyle
)
{
div
.
style
.
width
=
"1px"
;
div
.
style
.
marginRight
=
"0"
;
jQuery
.
support
.
reliableMarginRight
=
(
parseInt
(
document
.
defaultView
.
getComputedStyle
(
div
).
marginRight
,
10
)
||
0
)
===
0
;
}
body
.
removeChild
(
div
).
style
.
display
=
"none"
;
body
.
removeChild
(
div
).
style
.
display
=
"none"
;
div
=
tds
=
null
;
div
=
tds
=
null
;
});
});
...
...
test/unit/css.js
View file @
1912ded3
...
@@ -333,3 +333,15 @@ test("internal ref to elem.runtimeStyle (bug #7608)", function () {
...
@@ -333,3 +333,15 @@ test("internal ref to elem.runtimeStyle (bug #7608)", function () {
ok
(
result
,
"elem.runtimeStyle does not throw exception"
);
ok
(
result
,
"elem.runtimeStyle does not throw exception"
);
});
});
test
(
"marginRight computed style (bug #3333)"
,
function
()
{
expect
(
1
);
var
$div
=
jQuery
(
"#foo"
);
$div
.
css
({
width
:
"1px"
,
marginRight
:
0
});
equals
(
$div
.
css
(
"marginRight"
),
"0px"
);
});
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