Skip to main content

Search and Top Navigation

Ticket #3938: borderColorFix.patch


File borderColorFix.patch, 1.4 KB (added by bman654, September 09, 2009 12:38AM UTC)

This patch resolves the problem

Index: ui/effects.core.js
===================================================================
--- ui/effects.core.js	(revision 3202)
+++ ui/effects.core.js	(working copy)
@@ -117,7 +117,19 @@
 				&& newStyle[n] != oldStyle[n] /* Only values that have changed are used for the animation */
 				&& (n.match(/color/i) || (!n.match(/color/i) && !isNaN(parseInt(newStyle[n],10)))) /* Only things that can be parsed to integers or colors */
 				&& (oldStyle.position != "static" || (oldStyle.position == "static" && !n.match(/left|top|bottom|right/))) /* No need for positions when dealing with static positions */
-				) offset[n] = newStyle[n];
+				) {
+					if (n == "borderColor") {
+						// replace borderColor with the 4 border directions, if there is not already an entry for that direction
+						var colors = newStyle[n].split(/\\s+/);
+						if (colors.length == 1) colors = [colors[0], colors[0], colors[0], colors[0]];
+					  	else if (colors.length == 2) colors = [colors[0], colors[1], colors[0], colors[1]];
+					  	else if (colors.length == 3) colors = [colors[0], colors[1], colors[2], colors[1]];
+					  	$.each(['borderTopColor','borderRightColor','borderBottomColor','borderLeftColor'], function(i,attr) {
+								if (!offset[attr]) offset[attr]=colors[i];
+								});
+					}
+					else { offset[n] = newStyle[n]; }
+				}
 			}
 
 			that.animate(offset, duration, ea, function() { // Animate the newly constructed offset object

Download in other formats:

Original Format