mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Effect: Update jQuery Color from 2.2.0 to 3.0.0
Breaking changes applicable to jQuery UI:
* Use a space when serializing, remove the transparent case ([#88](https://github.com/jquery/jquery-color/issues/88), [aaf03cc](aaf03ccec3
))
See https://github.com/jquery/jquery-color/releases/tag/3.0.0 for more
information.
Fixes gh-2240
This commit is contained in:
parent
f849c50db1
commit
68fda5beb2
@ -12,7 +12,7 @@
|
||||
"jquery": ">=1.8.0 <4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"jquery-color": "2.2.0",
|
||||
"jquery-color": "3.0.0",
|
||||
"jquery-mousewheel": "3.1.12",
|
||||
"jquery-simulate": "1.1.1",
|
||||
"qunit": "2.19.4",
|
||||
|
65
ui/vendor/jquery-color/jquery.color.js
vendored
65
ui/vendor/jquery-color/jquery.color.js
vendored
@ -1,15 +1,17 @@
|
||||
/*!
|
||||
* jQuery Color Animations v2.2.0
|
||||
* jQuery Color Animations v3.0.0
|
||||
* https://github.com/jquery/jquery-color
|
||||
*
|
||||
* Copyright OpenJS Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* https://jquery.org/license
|
||||
*
|
||||
* Date: Sun May 10 09:02:36 2020 +0200
|
||||
* Date: Wed May 15 16:49:44 2024 +0200
|
||||
*/
|
||||
|
||||
( function( root, factory ) {
|
||||
"use strict";
|
||||
|
||||
if ( typeof define === "function" && define.amd ) {
|
||||
|
||||
// AMD. Register as an anonymous module.
|
||||
@ -20,6 +22,7 @@
|
||||
factory( root.jQuery );
|
||||
}
|
||||
} )( this, function( jQuery, undefined ) {
|
||||
"use strict";
|
||||
|
||||
var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " +
|
||||
"borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
|
||||
@ -145,10 +148,6 @@
|
||||
floor: true
|
||||
}
|
||||
},
|
||||
support = color.support = {},
|
||||
|
||||
// element for support tests
|
||||
supportElem = jQuery( "<p>" )[ 0 ],
|
||||
|
||||
// colors = jQuery.Color.names
|
||||
colors,
|
||||
@ -156,10 +155,6 @@
|
||||
// local aliases of functions called often
|
||||
each = jQuery.each;
|
||||
|
||||
// determine rgba support immediately
|
||||
supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
|
||||
support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
|
||||
|
||||
// define cache name and alpha properties
|
||||
// for rgba and hsla spaces
|
||||
each( spaces, function( spaceName, space ) {
|
||||
@ -197,12 +192,6 @@ function clamp( value, prop, allowEmpty ) {
|
||||
// ~~ is an short way of doing floor for positive numbers
|
||||
value = type.floor ? ~~value : parseFloat( value );
|
||||
|
||||
// IE will pass in empty strings as value for alpha,
|
||||
// which will hit this case
|
||||
if ( isNaN( value ) ) {
|
||||
return prop.def;
|
||||
}
|
||||
|
||||
if ( type.mod ) {
|
||||
|
||||
// we add mod before modding to make sure that negatives values
|
||||
@ -315,7 +304,10 @@ color.fn = jQuery.extend( color.prototype, {
|
||||
} );
|
||||
|
||||
// everything defined but alpha?
|
||||
if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
|
||||
if ( inst[ cache ] && jQuery.inArray(
|
||||
null,
|
||||
inst[ cache ].slice( 0, 3 )
|
||||
) < 0 ) {
|
||||
|
||||
// use the default of 1
|
||||
if ( inst[ cache ][ 3 ] == null ) {
|
||||
@ -427,7 +419,7 @@ color.fn = jQuery.extend( color.prototype, {
|
||||
prefix = "rgb(";
|
||||
}
|
||||
|
||||
return prefix + rgba.join() + ")";
|
||||
return prefix + rgba.join( ", " ) + ")";
|
||||
},
|
||||
toHslaString: function() {
|
||||
var prefix = "hsla(",
|
||||
@ -447,7 +439,7 @@ color.fn = jQuery.extend( color.prototype, {
|
||||
hsla.pop();
|
||||
prefix = "hsl(";
|
||||
}
|
||||
return prefix + hsla.join() + ")";
|
||||
return prefix + hsla.join( ", " ) + ")";
|
||||
},
|
||||
toHexString: function( includeAlpha ) {
|
||||
var rgba = this._rgba.slice(),
|
||||
@ -460,12 +452,11 @@ color.fn = jQuery.extend( color.prototype, {
|
||||
return "#" + jQuery.map( rgba, function( v ) {
|
||||
|
||||
// default to 0 when nulls exist
|
||||
v = ( v || 0 ).toString( 16 );
|
||||
return v.length === 1 ? "0" + v : v;
|
||||
return ( "0" + ( v || 0 ).toString( 16 ) ).substr( -2 );
|
||||
} ).join( "" );
|
||||
},
|
||||
toString: function() {
|
||||
return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
|
||||
return this.toRgbaString();
|
||||
}
|
||||
} );
|
||||
color.fn.parse.prototype = color.fn;
|
||||
@ -632,37 +623,15 @@ color.hook = function( hook ) {
|
||||
each( hooks, function( _i, hook ) {
|
||||
jQuery.cssHooks[ hook ] = {
|
||||
set: function( elem, value ) {
|
||||
var parsed, curElem,
|
||||
backgroundColor = "";
|
||||
var parsed;
|
||||
|
||||
if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
|
||||
if ( value !== "transparent" &&
|
||||
( getType( value ) !== "string" ||
|
||||
( parsed = stringParse( value ) ) ) ) {
|
||||
value = color( parsed || value );
|
||||
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
|
||||
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
|
||||
while (
|
||||
( backgroundColor === "" || backgroundColor === "transparent" ) &&
|
||||
curElem && curElem.style
|
||||
) {
|
||||
try {
|
||||
backgroundColor = jQuery.css( curElem, "backgroundColor" );
|
||||
curElem = curElem.parentNode;
|
||||
} catch ( e ) {
|
||||
}
|
||||
}
|
||||
|
||||
value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
|
||||
backgroundColor :
|
||||
"_default" );
|
||||
}
|
||||
|
||||
value = value.toRgbaString();
|
||||
}
|
||||
try {
|
||||
elem.style[ hook ] = value;
|
||||
} catch ( e ) {
|
||||
|
||||
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
|
||||
}
|
||||
}
|
||||
};
|
||||
jQuery.fx.step[ hook ] = function( fx ) {
|
||||
|
Loading…
Reference in New Issue
Block a user