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
558d96b4
Commit
558d96b4
authored
Sep 28, 2010
by
John Resig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make setting .css(name, undefined) a no-op. Fixes #4388.
parent
879799fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletion
+14
-1
css.js
src/css.js
+5
-0
css.js
test/unit/css.js
+9
-1
No files found.
src/css.js
View file @
558d96b4
...
...
@@ -20,6 +20,11 @@ var ralpha = /alpha\([^)]*\)/,
};
jQuery
.
fn
.
css
=
function
(
name
,
value
)
{
// Setting 'undefined' is a no-op
if
(
arguments
.
length
===
2
&&
value
===
undefined
)
{
return
this
;
}
return
jQuery
.
access
(
this
,
name
,
value
,
true
,
function
(
elem
,
name
,
value
)
{
return
value
!==
undefined
?
jQuery
.
style
(
elem
,
name
,
value
)
:
...
...
test/unit/css.js
View file @
558d96b4
...
...
@@ -64,7 +64,8 @@ test("css(String|Hash)", function() {
});
test
(
"css(String, Object)"
,
function
()
{
expect
(
19
);
expect
(
21
);
ok
(
jQuery
(
'#nothiddendiv'
).
is
(
':visible'
),
'Modifying CSS display: Assert element is visible'
);
jQuery
(
'#nothiddendiv'
).
css
(
"display"
,
'none'
);
ok
(
!
jQuery
(
'#nothiddendiv'
).
is
(
':visible'
),
'Modified CSS display: Assert element is hidden'
);
...
...
@@ -96,6 +97,13 @@ test("css(String, Object)", function() {
// opera sometimes doesn't update 'display' correctly, see #2037
jQuery
(
"#t2037"
)[
0
].
innerHTML
=
jQuery
(
"#t2037"
)[
0
].
innerHTML
equals
(
jQuery
(
"#t2037 .hidden"
).
css
(
"display"
),
"none"
,
"Make sure browser thinks it is hidden"
);
var
div
=
jQuery
(
"#nothiddendiv"
),
display
=
div
.
css
(
"display"
),
ret
=
div
.
css
(
"display"
,
undefined
);
equals
(
ret
,
div
,
"Make sure setting undefined returns the original set."
);
equals
(
div
.
css
(
"display"
),
display
,
"Make sure that the display wasn't changed."
);
});
if
(
jQuery
.
browser
.
msie
)
{
...
...
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