forked from jquery/jquery
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #11938: Adding array getter method to jQuery.fn.css
- Loading branch information
1 parent
d0d0fa2
commit 4b5b6cf
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,21 @@ function showHide( elements, show ) { | |
jQuery.fn.extend({ | ||
css: function( name, value ) { | ||
return jQuery.access( this, function( elem, name, value ) { | ||
var styles, len, | ||
map = {}, | ||
i = 0; | ||
|
||
if ( jQuery.isArray( name ) ) { | ||
styles = getStyles( elem ); | ||
len = name.length; | ||
|
||
for ( ; i < len; i++ ) { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
mikesherov
Author
Owner
|
||
map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); | ||
} | ||
|
||
return map; | ||
} | ||
|
||
return value !== undefined ? | ||
jQuery.style( elem, name, value ) : | ||
jQuery.css( elem, name ); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-3 bytes by dropping
len
(var i, styles, map = {};
) and changing this toi = name.length; while ( i-- ) {