@@ -21,7 +21,7 @@ $.effects = {
21
21
* jQuery Color Animations
22
22
* http://jquery.org/
23
23
*
24
- * Copyright 2011 John Resig
24
+ * Copyright 2012 John Resig
25
25
* Dual licensed under the MIT or GPL Version 2 licenses.
26
26
* http://jquery.org/license
27
27
*/
@@ -149,7 +149,6 @@ var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightCo
149
149
floor : true
150
150
}
151
151
} ,
152
- rgbaspace = spaces . rgba . props ,
153
152
support = color . support = { } ,
154
153
155
154
// colors = jQuery.Color.names
@@ -158,11 +157,11 @@ var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightCo
158
157
// local aliases of functions called often
159
158
each = jQuery . each ;
160
159
161
- spaces . hsla . props . alpha = rgbaspace . alpha ;
160
+ spaces . hsla . props . alpha = spaces . rgba . props . alpha ;
162
161
163
162
function clamp ( value , prop , alwaysAllowEmpty ) {
164
163
var type = propTypes [ prop . type ] || { } ,
165
- allowEmpty = prop . empty || alwaysAllowEmpty ;
164
+ allowEmpty = alwaysAllowEmpty || prop . empty ;
166
165
167
166
if ( allowEmpty && value == null ) {
168
167
return null ;
@@ -179,7 +178,7 @@ function clamp( value, prop, alwaysAllowEmpty ) {
179
178
return prop . def ;
180
179
}
181
180
if ( type . mod ) {
182
- value = value % type . mod ;
181
+ value %= type . mod ;
183
182
// -10 -> 350
184
183
return value < 0 ? type . mod + value : value ;
185
184
}
@@ -226,21 +225,18 @@ function stringParse( string ) {
226
225
return inst ;
227
226
}
228
227
229
- // named colors / default - filter back through parse function
230
- if ( string = colors [ string ] ) {
231
- return string ;
232
- }
228
+ // named colors
229
+ return colors [ string ] ;
233
230
}
234
231
235
- color . fn = color . prototype = {
236
- constructor : color ,
232
+ color . fn = jQuery . extend ( color . prototype , {
237
233
parse : function ( red , green , blue , alpha ) {
238
234
if ( red === undefined ) {
239
235
this . _rgba = [ null , null , null , null ] ;
240
236
return this ;
241
237
}
242
- if ( red instanceof jQuery || red . nodeType ) {
243
- red = red instanceof jQuery ? red . css ( green ) : jQuery ( red ) . css ( green ) ;
238
+ if ( red . jquery || red . nodeType ) {
239
+ red = jQuery ( red ) . css ( green ) ;
244
240
green = undefined ;
245
241
}
246
242
@@ -260,7 +256,7 @@ color.fn = color.prototype = {
260
256
}
261
257
262
258
if ( type === "array" ) {
263
- each ( rgbaspace , function ( key , prop ) {
259
+ each ( spaces . rgba . props , function ( key , prop ) {
264
260
rgba [ prop . idx ] = clamp ( red [ prop . idx ] , prop ) ;
265
261
} ) ;
266
262
return this ;
@@ -428,7 +424,7 @@ color.fn = color.prototype = {
428
424
toString : function ( ) {
429
425
return this . _rgba [ 3 ] === 0 ? "transparent" : this . toRgbaString ( ) ;
430
426
}
431
- } ;
427
+ } ) ;
432
428
color . fn . parse . prototype = color . fn ;
433
429
434
430
// hsla conversions adapted from:
0 commit comments