File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ oldFnCss = jQuery.fn.css;
101
101
jQuery . fn . css = function ( name , value ) {
102
102
var camelName ,
103
103
origThis = this ;
104
- if ( typeof name !== "string" ) {
104
+ if ( name && typeof name === "object" && ! Array . isArray ( name ) ) {
105
105
jQuery . each ( name , function ( n , v ) {
106
106
jQuery . fn . css . call ( origThis , n , v ) ;
107
107
} ) ;
Original file line number Diff line number Diff line change @@ -44,6 +44,22 @@ QUnit[ ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) ? "test
44
44
delete jQuery . cssProps . devoHat ;
45
45
} ) ;
46
46
47
+ QUnit . test ( "jQuery.css with arrays" , function ( assert ) {
48
+ assert . expect ( 2 ) ;
49
+
50
+ expectNoWarning ( assert , "String value direct" , function ( ) {
51
+ var cssValues = jQuery ( "<div />" )
52
+ . css ( {
53
+ lineHeight : "1" ,
54
+ fontSize : "16px"
55
+ } )
56
+ . css ( [ "font-size" , "lineHeight" ] ) ;
57
+
58
+ assert . deepEqual ( cssValues , { "font-size" : "16px" , lineHeight : "1" } ,
59
+ ".css( array ) works" ) ;
60
+ } ) ;
61
+ } ) ;
62
+
47
63
QUnit . test ( "jQuery.css with numbers" , function ( assert ) {
48
64
var jQuery3OrOlder = compareVersions ( jQuery . fn . jquery , "4.0.0" ) < 0 ,
49
65
whitelist = [
You can’t perform that action at this time.
0 commit comments