From 536d112aa9f49513f73e9d152866a4f67660d183 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Scott=20Gonz=C3=A1lez?= Date: Tue, 14 Aug 2012 08:45:58 -0400 Subject: [PATCH] Upgrade jQuery Color to 2.0.0. Fixes #6969 - Effects: 'borderColor' property is buggy. --- ui/jquery.ui.effect.js | 50 ++++++++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 12 deletions(-) diff --git a/ui/jquery.ui.effect.js b/ui/jquery.ui.effect.js index ec8260709..d362ca017 100644 --- a/ui/jquery.ui.effect.js +++ b/ui/jquery.ui.effect.js @@ -19,12 +19,14 @@ $.effects = { }; /*! - * jQuery Color Animations + * jQuery Color Animations v2.0.0 * http://jquery.com/ * * Copyright 2012 jQuery Foundation and other contributors - * Dual licensed under the MIT or GPL Version 2 licenses. + * Released under the MIT license. * http://jquery.org/license + * + * Date: Mon Aug 13 13:41:02 2012 -0500 */ (function( jQuery, undefined ) { @@ -272,8 +274,8 @@ color.fn = jQuery.extend( color.prototype, { }); } else { each( spaces, function( spaceName, space ) { + var cache = space.cache; each( space.props, function( key, prop ) { - var cache = space.cache; // if the cache doesn't exist, and we know how to convert if ( !inst[ cache ] && space.to ) { @@ -290,6 +292,15 @@ color.fn = jQuery.extend( color.prototype, { // call clamp with alwaysAllowEmpty inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); }); + + // everything defined but alpha? + if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { + // use the default of 1 + inst[ cache ][ 3 ] = 1; + if ( space.from ) { + inst._rgba = space.from( inst[ cache ] ); + } + } }); } return this; @@ -581,19 +592,23 @@ each( spaces, function( spaceName, space ) { each( stepHooks, function( i, hook ) { jQuery.cssHooks[ hook ] = { set: function( elem, value ) { - var parsed, backgroundColor, curElem; + var parsed, curElem, + backgroundColor = ""; if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) { value = color( parsed || value ); if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { curElem = hook === "backgroundColor" ? elem.parentNode : elem; - do { - backgroundColor = jQuery.css( curElem, "backgroundColor" ); - } while ( - ( backgroundColor === "" || backgroundColor === "transparent" ) && - ( curElem = curElem.parentNode ) && - curElem.style - ); + 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 : @@ -619,6 +634,17 @@ each( stepHooks, function( i, hook ) { }; }); +jQuery.cssHooks.borderColor = { + expand: function( value ) { + var expanded = {}; + + each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { + expanded[ "border" + part + "Color" ] = value; + }); + return expanded; + } +}; + // Basic color names only. // Usage of any of the other color names requires adding yourself or including // jquery.color.svg-names.js. @@ -641,7 +667,7 @@ colors = jQuery.Color.names = { white: "#ffffff", yellow: "#ffff00", - // 4.2.3. ‘transparent’ color keyword + // 4.2.3. "transparent" color keyword transparent: [ null, null, null, 0 ], _default: "#ffffff" -- 2.39.5