bulk = key == null;
// Sets many values
- if ( key && typeof key === "object" ) {
+ if ( jQuery.type( key ) === "object" ) {
chainable = true;
for ( i in key ) {
jQuery.access( elems, fn, i, key[i], true, emptyGet, raw );
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++ ) {
+ map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
+ }
+
+ return map;
+ }
+
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
ok( success, "Setting RGBA values does not throw Error" );
});
+test( "css(Array)", function() {
+ expect( 2 );
+
+ var expectedMany = {
+ "overflow": "visible",
+ "width": "16px"
+ },
+ expectedSingle = {
+ "width": "16px"
+ },
+ elem = jQuery("<div></div>").appendTo("#qunit-fixture");
+
+ deepEqual( elem.css( expectedMany ).css([ "overflow", "width" ]), expectedMany, "Getting multiple element array" );
+ deepEqual( elem.css( expectedSingle ).css([ "width" ]), expectedSingle, "Getting single element array" );
+});
+
if ( !jQuery.support.opacity ) {
test("css(String, Object) for MSIE", function() {
expect( 5 );