11/*!
2- * jQuery Color Animations v2.2 .0
2+ * jQuery Color Animations v3.0 .0
33 * https://github.com/jquery/jquery-color
44 *
55 * Copyright OpenJS Foundation and other contributors
66 * Released under the MIT license.
77 * https://jquery.org/license
88 *
9- * Date: Sun May 10 09:02:36 2020 +0200
9+ * Date: Wed May 15 16:49:44 2024 +0200
1010 */
1111
1212( function ( root , factory ) {
13+ "use strict" ;
14+
1315 if ( typeof define === "function" && define . amd ) {
1416
1517 // AMD. Register as an anonymous module.
2022 factory ( root . jQuery ) ;
2123 }
2224} ) ( this , function ( jQuery , undefined ) {
25+ "use strict" ;
2326
2427 var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
2528 "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor" ,
145148 floor : true
146149 }
147150 } ,
148- support = color . support = { } ,
149-
150- // element for support tests
151- supportElem = jQuery ( "<p>" ) [ 0 ] ,
152151
153152 // colors = jQuery.Color.names
154153 colors ,
155154
156155 // local aliases of functions called often
157156 each = jQuery . each ;
158157
159- // determine rgba support immediately
160- supportElem . style . cssText = "background-color:rgba(1,1,1,.5)" ;
161- support . rgba = supportElem . style . backgroundColor . indexOf ( "rgba" ) > - 1 ;
162-
163158// define cache name and alpha properties
164159// for rgba and hsla spaces
165160each ( spaces , function ( spaceName , space ) {
@@ -197,12 +192,6 @@ function clamp( value, prop, allowEmpty ) {
197192 // ~~ is an short way of doing floor for positive numbers
198193 value = type . floor ? ~ ~ value : parseFloat ( value ) ;
199194
200- // IE will pass in empty strings as value for alpha,
201- // which will hit this case
202- if ( isNaN ( value ) ) {
203- return prop . def ;
204- }
205-
206195 if ( type . mod ) {
207196
208197 // we add mod before modding to make sure that negatives values
@@ -315,7 +304,10 @@ color.fn = jQuery.extend( color.prototype, {
315304 } ) ;
316305
317306 // everything defined but alpha?
318- if ( inst [ cache ] && jQuery . inArray ( null , inst [ cache ] . slice ( 0 , 3 ) ) < 0 ) {
307+ if ( inst [ cache ] && jQuery . inArray (
308+ null ,
309+ inst [ cache ] . slice ( 0 , 3 )
310+ ) < 0 ) {
319311
320312 // use the default of 1
321313 if ( inst [ cache ] [ 3 ] == null ) {
@@ -427,7 +419,7 @@ color.fn = jQuery.extend( color.prototype, {
427419 prefix = "rgb(" ;
428420 }
429421
430- return prefix + rgba . join ( ) + ")" ;
422+ return prefix + rgba . join ( ", " ) + ")" ;
431423 } ,
432424 toHslaString : function ( ) {
433425 var prefix = "hsla(" ,
@@ -447,7 +439,7 @@ color.fn = jQuery.extend( color.prototype, {
447439 hsla . pop ( ) ;
448440 prefix = "hsl(" ;
449441 }
450- return prefix + hsla . join ( ) + ")" ;
442+ return prefix + hsla . join ( ", " ) + ")" ;
451443 } ,
452444 toHexString : function ( includeAlpha ) {
453445 var rgba = this . _rgba . slice ( ) ,
@@ -460,12 +452,11 @@ color.fn = jQuery.extend( color.prototype, {
460452 return "#" + jQuery . map ( rgba , function ( v ) {
461453
462454 // default to 0 when nulls exist
463- v = ( v || 0 ) . toString ( 16 ) ;
464- return v . length === 1 ? "0" + v : v ;
455+ return ( "0" + ( v || 0 ) . toString ( 16 ) ) . substr ( - 2 ) ;
465456 } ) . join ( "" ) ;
466457 } ,
467458 toString : function ( ) {
468- return this . _rgba [ 3 ] === 0 ? "transparent" : this . toRgbaString ( ) ;
459+ return this . toRgbaString ( ) ;
469460 }
470461} ) ;
471462color . fn . parse . prototype = color . fn ;
@@ -632,37 +623,15 @@ color.hook = function( hook ) {
632623 each ( hooks , function ( _i , hook ) {
633624 jQuery . cssHooks [ hook ] = {
634625 set : function ( elem , value ) {
635- var parsed , curElem ,
636- backgroundColor = "" ;
626+ var parsed ;
637627
638- if ( value !== "transparent" && ( getType ( value ) !== "string" || ( parsed = stringParse ( value ) ) ) ) {
628+ if ( value !== "transparent" &&
629+ ( getType ( value ) !== "string" ||
630+ ( parsed = stringParse ( value ) ) ) ) {
639631 value = color ( parsed || value ) ;
640- if ( ! support . rgba && value . _rgba [ 3 ] !== 1 ) {
641- curElem = hook === "backgroundColor" ? elem . parentNode : elem ;
642- while (
643- ( backgroundColor === "" || backgroundColor === "transparent" ) &&
644- curElem && curElem . style
645- ) {
646- try {
647- backgroundColor = jQuery . css ( curElem , "backgroundColor" ) ;
648- curElem = curElem . parentNode ;
649- } catch ( e ) {
650- }
651- }
652-
653- value = value . blend ( backgroundColor && backgroundColor !== "transparent" ?
654- backgroundColor :
655- "_default" ) ;
656- }
657-
658632 value = value . toRgbaString ( ) ;
659633 }
660- try {
661- elem . style [ hook ] = value ;
662- } catch ( e ) {
663-
664- // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
665- }
634+ elem . style [ hook ] = value ;
666635 }
667636 } ;
668637 jQuery . fx . step [ hook ] = function ( fx ) {
0 commit comments