Skip to content

Commit 536d112

Browse files
committed
Upgrade jQuery Color to 2.0.0. Fixes #6969 - Effects: 'borderColor' property is buggy.
1 parent 1e6b2b2 commit 536d112

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

ui/jquery.ui.effect.js

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ $.effects = {
1919
};
2020

2121
/*!
22-
* jQuery Color Animations
22+
* jQuery Color Animations v2.0.0
2323
* http://jquery.com/
2424
*
2525
* Copyright 2012 jQuery Foundation and other contributors
26-
* Dual licensed under the MIT or GPL Version 2 licenses.
26+
* Released under the MIT license.
2727
* http://jquery.org/license
28+
*
29+
* Date: Mon Aug 13 13:41:02 2012 -0500
2830
*/
2931
(function( jQuery, undefined ) {
3032

@@ -272,8 +274,8 @@ color.fn = jQuery.extend( color.prototype, {
272274
});
273275
} else {
274276
each( spaces, function( spaceName, space ) {
277+
var cache = space.cache;
275278
each( space.props, function( key, prop ) {
276-
var cache = space.cache;
277279

278280
// if the cache doesn't exist, and we know how to convert
279281
if ( !inst[ cache ] && space.to ) {
@@ -290,6 +292,15 @@ color.fn = jQuery.extend( color.prototype, {
290292
// call clamp with alwaysAllowEmpty
291293
inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
292294
});
295+
296+
// everything defined but alpha?
297+
if ( inst[ cache ] && $.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
298+
// use the default of 1
299+
inst[ cache ][ 3 ] = 1;
300+
if ( space.from ) {
301+
inst._rgba = space.from( inst[ cache ] );
302+
}
303+
}
293304
});
294305
}
295306
return this;
@@ -581,19 +592,23 @@ each( spaces, function( spaceName, space ) {
581592
each( stepHooks, function( i, hook ) {
582593
jQuery.cssHooks[ hook ] = {
583594
set: function( elem, value ) {
584-
var parsed, backgroundColor, curElem;
595+
var parsed, curElem,
596+
backgroundColor = "";
585597

586598
if ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) {
587599
value = color( parsed || value );
588600
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
589601
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
590-
do {
591-
backgroundColor = jQuery.css( curElem, "backgroundColor" );
592-
} while (
593-
( backgroundColor === "" || backgroundColor === "transparent" ) &&
594-
( curElem = curElem.parentNode ) &&
595-
curElem.style
596-
);
602+
while (
603+
(backgroundColor === "" || backgroundColor === "transparent") &&
604+
curElem && curElem.style
605+
) {
606+
try {
607+
backgroundColor = jQuery.css( curElem, "backgroundColor" );
608+
curElem = curElem.parentNode;
609+
} catch ( e ) {
610+
}
611+
}
597612

598613
value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
599614
backgroundColor :
@@ -619,6 +634,17 @@ each( stepHooks, function( i, hook ) {
619634
};
620635
});
621636

637+
jQuery.cssHooks.borderColor = {
638+
expand: function( value ) {
639+
var expanded = {};
640+
641+
each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
642+
expanded[ "border" + part + "Color" ] = value;
643+
});
644+
return expanded;
645+
}
646+
};
647+
622648
// Basic color names only.
623649
// Usage of any of the other color names requires adding yourself or including
624650
// jquery.color.svg-names.js.
@@ -641,7 +667,7 @@ colors = jQuery.Color.names = {
641667
white: "#ffffff",
642668
yellow: "#ffff00",
643669

644-
// 4.2.3. transparent color keyword
670+
// 4.2.3. "transparent" color keyword
645671
transparent: [ null, null, null, 0 ],
646672

647673
_default: "#ffffff"

0 commit comments

Comments
 (0)