File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 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;
101101jQuery . fn . css = function ( name , value ) {
102102 var camelName ,
103103 origThis = this ;
104- if ( typeof name !== "string" ) {
104+ if ( name && typeof name === "object" && ! Array . isArray ( name ) ) {
105105 jQuery . each ( name , function ( n , v ) {
106106 jQuery . fn . css . call ( origThis , n , v ) ;
107107 } ) ;
Original file line number Diff line number Diff line change @@ -44,6 +44,22 @@ QUnit[ ( jQueryVersionSince( "3.4.0" ) && typeof Proxy !== "undefined" ) ? "test
4444 delete jQuery . cssProps . devoHat ;
4545} ) ;
4646
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+
4763QUnit . test ( "jQuery.css with numbers" , function ( assert ) {
4864 var jQuery3OrOlder = compareVersions ( jQuery . fn . jquery , "4.0.0" ) < 0 ,
4965 whitelist = [
You can’t perform that action at this time.
0 commit comments