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
272b8d69
Commit
272b8d69
authored
Apr 11, 2011
by
louisremi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
replace cssPropsAware branch
parent
56ffad2d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
6 deletions
+26
-6
css.js
src/css.js
+12
-6
css.js
test/unit/css.js
+14
-0
No files found.
src/css.js
View file @
272b8d69
...
@@ -123,10 +123,16 @@ jQuery.extend({
...
@@ -123,10 +123,16 @@ jQuery.extend({
css
:
function
(
elem
,
name
,
extra
)
{
css
:
function
(
elem
,
name
,
extra
)
{
// Make sure that we're working with the right name
// Make sure that we're working with the right name
var
ret
,
origName
=
jQuery
.
camelCase
(
name
),
var
ret
,
hooks
=
jQuery
.
cssHooks
[
origName
]
;
hooks
;
name
=
jQuery
.
cssProps
[
origName
]
||
origName
;
name
=
jQuery
.
camelCase
(
name
);
hooks
=
jQuery
.
cssHooks
[
name
];
name
=
jQuery
.
cssProps
[
name
]
||
name
;
// cssFloat needs a special treatment
if
(
name
===
'cssFloat'
)
{
name
=
'float'
;
}
// If a hook was provided get the computed value from there
// If a hook was provided get the computed value from there
if
(
hooks
&&
"get"
in
hooks
&&
(
ret
=
hooks
.
get
(
elem
,
true
,
extra
))
!==
undefined
)
{
if
(
hooks
&&
"get"
in
hooks
&&
(
ret
=
hooks
.
get
(
elem
,
true
,
extra
))
!==
undefined
)
{
...
@@ -134,7 +140,7 @@ jQuery.extend({
...
@@ -134,7 +140,7 @@ jQuery.extend({
// Otherwise, if a way to get the computed value exists, use that
// Otherwise, if a way to get the computed value exists, use that
}
else
if
(
curCSS
)
{
}
else
if
(
curCSS
)
{
return
curCSS
(
elem
,
name
,
origName
);
return
curCSS
(
elem
,
name
);
}
}
},
},
...
@@ -273,7 +279,7 @@ jQuery(function() {
...
@@ -273,7 +279,7 @@ jQuery(function() {
});
});
if
(
document
.
defaultView
&&
document
.
defaultView
.
getComputedStyle
)
{
if
(
document
.
defaultView
&&
document
.
defaultView
.
getComputedStyle
)
{
getComputedStyle
=
function
(
elem
,
n
ewName
,
n
ame
)
{
getComputedStyle
=
function
(
elem
,
name
)
{
var
ret
,
defaultView
,
computedStyle
;
var
ret
,
defaultView
,
computedStyle
;
name
=
name
.
replace
(
rupper
,
"-$1"
).
toLowerCase
();
name
=
name
.
replace
(
rupper
,
"-$1"
).
toLowerCase
();
...
...
test/unit/css.js
View file @
272b8d69
...
@@ -377,3 +377,17 @@ test("marginRight computed style (bug #3333)", function() {
...
@@ -377,3 +377,17 @@ test("marginRight computed style (bug #3333)", function() {
equals
(
$div
.
css
(
"marginRight"
),
"0px"
);
equals
(
$div
.
css
(
"marginRight"
),
"0px"
);
});
});
test
(
"jQuery.cssProps behavior, (bug #8402)"
,
function
()
{
var
div
=
jQuery
(
"<div>"
).
appendTo
(
document
.
body
).
css
({
position
:
"absolute"
,
top
:
0
,
left
:
10
});
jQuery
.
cssProps
.
top
=
"left"
;
equal
(
div
.
css
(
"top"
),
"10px"
,
"the fixed property is used when accessing the computed style"
);
div
.
css
(
"top"
,
"100px"
);
equal
(
div
[
0
].
style
.
left
,
"100px"
,
"the fixed property is used when setting the style"
);
// cleanup jQuery.cssProps
jQuery
.
cssProps
.
top
=
undefined
;
});
\ No newline at end of file
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