aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/unit/button/button_core.js14
-rw-r--r--tests/unit/effects/effects.html20
-rw-r--r--tests/unit/effects/effects_core.js71
-rw-r--r--themes/base/jquery.ui.theme.css13
-rw-r--r--ui/jquery.effects.core.js190
-rw-r--r--ui/jquery.ui.button.js37
-rw-r--r--ui/jquery.ui.datepicker.js13
-rw-r--r--ui/jquery.ui.draggable.js5
8 files changed, 250 insertions, 113 deletions
diff --git a/tests/unit/button/button_core.js b/tests/unit/button/button_core.js
index 5b30aa860..692c40320 100644
--- a/tests/unit/button/button_core.js
+++ b/tests/unit/button/button_core.js
@@ -67,4 +67,18 @@ test("buttonset", function() {
ok( set.children("label:eq(2)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") );
});
+test("buttonset (rtl)", function() {
+ var parent = $("#radio1").parent();
+ // Set to rtl
+ parent.attr("dir", "rtl");
+
+ var set = $("#radio1").buttonset();
+ ok( set.is(".ui-buttonset") );
+ same( set.children(".ui-button").length, 3 );
+ same( set.children("input:radio.ui-helper-hidden-accessible").length, 3 );
+ ok( set.children("label:eq(0)").is(".ui-button.ui-corner-right:not(.ui-corner-all)") );
+ ok( set.children("label:eq(1)").is(".ui-button:not(.ui-corner-all)") );
+ ok( set.children("label:eq(2)").is(".ui-button.ui-corner-left:not(.ui-corner-all)") );
+});
+
})(jQuery);
diff --git a/tests/unit/effects/effects.html b/tests/unit/effects/effects.html
index 2cffda7ec..0879a98b2 100644
--- a/tests/unit/effects/effects.html
+++ b/tests/unit/effects/effects.html
@@ -35,6 +35,22 @@
.hidden {
display: none;
}
+ .test {
+ background: #000;
+ border: 0;
+ }
+ .testAddBorder {
+ border: 10px solid #000;
+ }
+ .testChangeBackground {
+ background: #fff;
+ }
+ .test h2 {
+ font-size: 10px;
+ }
+ .testChildren h2 {
+ font-size: 20px;
+ }
</style>
</head>
<body>
@@ -48,7 +64,9 @@
<div id="qunit-fixture">
<div class="hidden test"></div>
- <div class="shown test"></div>
+ <div class="animateClass test">
+ <h2>Child Element Test</h2>
+ </div>
</div>
</body>
diff --git a/tests/unit/effects/effects_core.js b/tests/unit/effects/effects_core.js
index 0359b73d3..044cc1695 100644
--- a/tests/unit/effects/effects_core.js
+++ b/tests/unit/effects/effects_core.js
@@ -1,5 +1,13 @@
(function($) {
+function present( value, array, message ) {
+ QUnit.push( jQuery.inArray( value, array ) !== -1 , value, array, message );
+}
+
+function notPresent( value, array, message ) {
+ QUnit.push( jQuery.inArray( value, array ) === -1 , value, array, message );
+}
+
var animateTime = 15;
module( "effects.core" );
@@ -8,12 +16,10 @@ $.each( $.effects.effect, function( effect ) {
if ( effect === "transfer" ) {
return;
}
- QUnit.reset();
module( "effect."+effect );
- test( "show/hide", function() {
+ asyncTest( "show/hide", function() {
var hidden = $( "div.hidden" );
expect( 8 );
- stop();
var count = 0,
test = 0;
@@ -23,13 +29,13 @@ $.each( $.effects.effect, function( effect ) {
var point = count;
return function( next ) {
test++;
- equals( point, test, "Queue function fired in order" );
+ equal( point, test, "Queue function fired in order" );
if ( fn ) {
- fn ()
+ fn ();
} else {
setTimeout( next, animateTime );
}
- }
+ };
}
hidden.queue( queueTest() ).show( effect, animateTime, queueTest(function() {
@@ -37,10 +43,61 @@ $.each( $.effects.effect, function( effect ) {
})).queue( queueTest() ).hide( effect, animateTime, queueTest(function() {
equal( hidden.css("display"), "none", "Back to hidden after .hide(\"" +effect+ "\", time)" );
})).queue( queueTest(function(next) {
- deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains")
+ deepEqual( hidden.queue(), ["inprogress"], "Only the inprogress sentinel remains");
start();
}));
});
});
+module("animateClass");
+
+asyncTest( "animateClass works with borderStyle", function() {
+ var test = $("div.animateClass"),
+ count = 0;
+ expect(3);
+ test.toggleClass("testAddBorder", 20, function() {
+ test.toggleClass("testAddBorder", 20, function() {
+ equal( test.css("borderLeftStyle"), "none", "None border set" );
+ start();
+ });
+ equal( test.css("borderLeftStyle"), "solid", "None border not immedately set" );
+ });
+ equal( test.css("borderLeftStyle"), "solid", "Solid border immedately set" );
+});
+
+asyncTest( "animateClass works with colors", function() {
+ var test = $("div.animateClass"),
+ count = 0;
+ expect(2);
+ test.toggleClass("testChangeBackground", 100, function() {
+ present( test.css("backgroundColor"), [ "#ffffff", "rgb(255, 255, 255)" ], "Color is final" );
+ start();
+ });
+ setTimeout(function() {
+ var color = test.css("backgroundColor");
+ notPresent( color, [ "#000000", "#ffffff", "rgb(0, 0, 0)", "rgb(255,255,255)" ],
+ "Color is not endpoints in middle." );
+ }, 50);
+});
+
+asyncTest( "animateClass works with children", function() {
+ var test = $("div.animateClass"),
+ h2 = test.find("h2");
+
+ expect(4);
+ test.toggleClass("testChildren", { children: true, duration: 100, complete: function() {
+ equal( h2.css("fontSize"), "20px", "Text size is final during complete");
+ test.toggleClass("testChildren", 100, function() {
+ equal( h2.css("fontSize"), "10px", "Text size revertted after class removed");
+ start();
+ });
+ setTimeout(function() {
+ equal( h2.css("fontSize"), "20px", "Text size unchanged with children: undefined" );
+ }, 50);
+ }});
+ setTimeout(function() {
+ notPresent( h2.css("fontSize"), ["10px","20px"], "Font size is neither endpoint when in middle.");
+ }, 50);
+});
+
})(jQuery);
diff --git a/themes/base/jquery.ui.theme.css b/themes/base/jquery.ui.theme.css
index 7d4398465..de15086f9 100644
--- a/themes/base/jquery.ui.theme.css
+++ b/themes/base/jquery.ui.theme.css
@@ -237,15 +237,10 @@
----------------------------------*/
/* Corner radius */
-.ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-top { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-bottom { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-right { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-left { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
-.ui-corner-all { -moz-border-radius: 4px/*{cornerRadius}*/; -webkit-border-radius: 4px/*{cornerRadius}*/; border-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-all, .ui-corner-top, .ui-corner-right .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }
+.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }
/* Overlays */
.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }
diff --git a/ui/jquery.effects.core.js b/ui/jquery.effects.core.js
index 2ed89653d..638119579 100644
--- a/ui/jquery.effects.core.js
+++ b/ui/jquery.effects.core.js
@@ -20,8 +20,8 @@ $.effects = {
/******************************************************************************/
// override the animation for color styles
-$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',
- 'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],
+$.each(["backgroundColor", "borderBottomColor", "borderLeftColor",
+ "borderRightColor", "borderTopColor", "borderColor", "color", "outlineColor"],
function(i, attr) {
$.fx.step[attr] = function(fx) {
if (!fx.colorInit) {
@@ -30,10 +30,10 @@ function(i, attr) {
fx.colorInit = true;
}
- fx.elem.style[attr] = 'rgb(' +
- Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +
- Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +
- Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';
+ fx.elem.style[attr] = "rgb(" +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + "," +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + "," +
+ Math.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ")";
};
});
@@ -46,7 +46,7 @@ function getRGB(color) {
var result;
// Check if we're already dealing with an array of colors
- if ( color && color.constructor == Array && color.length == 3 )
+ if ( color && color.constructor === Array && color.length === 3 )
return color;
// Look for rgb(num,num,num)
@@ -67,7 +67,7 @@ function getRGB(color) {
// Look for rgba(0, 0, 0, 0) == transparent in Safari 3
if (result = /rgba\(0, 0, 0, 0\)/.exec(color))
- return colors['transparent'];
+ return colors["transparent"];
// Otherwise, we're most likely dealing with a named color
return colors[$.trim(color).toLowerCase()];
@@ -80,7 +80,7 @@ function getColor(elem, attr) {
color = $.curCSS(elem, attr);
// Keep going until we find an element that has color, or we hit the body
- if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") )
+ if ( color != "" && color !== "transparent" || $.nodeName(elem, "body") )
break;
attr = "backgroundColor";
@@ -160,7 +160,7 @@ var classAnimationActions = [ "add", "remove", "toggle" ],
},
// prefix used for storing data on .data()
dataSpace = "ec.storage.";
-
+
$.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopStyle" ], function(_, prop) {
$.fx.step[ prop ] = function( fx ) {
if ( fx.end !== "none" && !fx.setAttr || fx.pos === 1 && !fx.setAttr ) {
@@ -168,7 +168,7 @@ $.each([ "borderLeftStyle", "borderRightStyle", "borderBottomStyle", "borderTopS
fx.setAttr = true;
}
};
-})
+});
function getElementStyles() {
var style = document.defaultView
@@ -225,63 +225,93 @@ $.effects.animateClass = function( value, duration, easing, callback ) {
var animated = $( this ),
baseClass = animated.attr( "class" ),
finalClass,
- originalStyleAttr = animated.attr( "style" ) || ' ',
- originalStyle = getElementStyles.call( this ),
- newStyle,
- diff,
- prop;
+ allAnimations = o.children ? animated.find( "*" ).andSelf() : animated;
+
+ // map the animated objects to store the original styles.
+ allAnimations = allAnimations.map(function() {
+ var el = $( this );
+ return {
+ el: el,
+ originalStyleAttr: el.attr( "style" ) || " ",
+ start: getElementStyles.call( this )
+ };
+ });
+ // apply class change
$.each( classAnimationActions, function(i, action) {
if ( value[ action ] ) {
animated[ action + "Class" ]( value[ action ] );
}
});
- newStyle = getElementStyles.call( this );
finalClass = animated.attr( "class" );
+
+ // map all animated objects again - calculate new styles and diff
+ allAnimations = allAnimations.map(function() {
+ this.end = getElementStyles.call( this.el[ 0 ] );
+ this.diff = styleDifference( this.start, this.end );
+ return this;
+ });
+
+ // apply original class
animated.attr( "class", baseClass );
- diff = styleDifference( originalStyle, newStyle );
- animated
- .animate( diff, {
- duration: duration,
+ // map all animated objects again - this time collecting a promise
+ allAnimations = allAnimations.map(function() {
+ var styleInfo = this,
+ dfd = $.Deferred();
+
+ this.el.animate( this.diff, {
+ duration: o.duration,
easing: o.easing,
queue: false,
complete: function() {
- animated.attr( "class", finalClass );
+ dfd.resolve( styleInfo );
+ }
+ });
+ return dfd.promise();
+ });
- if ( typeof animated.attr( 'style' ) == 'object' ) {
- animated.attr( 'style' ).cssText = '';
- animated.attr( 'style' ).cssText = originalStyleAttr;
- } else {
- animated.attr( 'style', originalStyleAttr );
- }
+ // once all animations have completed:
+ $.when.apply( $, allAnimations.get() ).done(function() {
+
+ // set the final class
+ animated.attr( "class", finalClass );
- // this is guarnteed to be there if you use jQuery.speed()
- // it also handles dequeuing the next anim...
- o.complete.call( this );
+ // for each animated element
+ $.each( arguments, function() {
+ if ( typeof this.el.attr( "style" ) === "object" ) {
+ this.el.attr( "style" ).cssText = "";
+ this.el.attr( "style" ).cssText = this.originalStyleAttr;
+ } else {
+ this.el.attr( "style", this.originalStyleAttr );
}
});
+
+ // this is guarnteed to be there if you use jQuery.speed()
+ // it also handles dequeuing the next anim...
+ o.complete.call( animated[ 0 ] );
+ });
});
};
$.fn.extend({
_addClass: $.fn.addClass,
addClass: function( classNames, speed, easing, callback ) {
- return speed ?
+ return speed ?
$.effects.animateClass.apply( this, [{ add: classNames }, speed, easing, callback ]) :
this._addClass(classNames);
},
_removeClass: $.fn.removeClass,
removeClass: function( classNames, speed, easing, callback ) {
- return speed ?
+ return speed ?
$.effects.animateClass.apply( this, [{ remove: classNames }, speed, easing, callback ]) :
this._removeClass(classNames);
},
_toggleClass: $.fn.toggleClass,
toggleClass: function( classNames, force, speed, easing, callback ) {
- if ( typeof force == "boolean" || force === undefined ) {
+ if ( typeof force === "boolean" || force === undefined ) {
if ( !speed ) {
// without speed parameter;
return this._toggleClass( classNames, force );
@@ -295,9 +325,9 @@ $.fn.extend({
},
switchClass: function( remove, add, speed, easing, callback) {
- return $.effects.animateClass.apply( this, [{
- add: add,
- remove: remove
+ return $.effects.animateClass.apply( this, [{
+ add: add,
+ remove: remove
}, speed, easing, callback ]);
}
});
@@ -330,26 +360,26 @@ $.extend( $.effects, {
},
setMode: function( el, mode ) {
- if (mode == 'toggle') {
- mode = el.is( ':hidden' ) ? 'show' : 'hide';
+ if (mode === "toggle") {
+ mode = el.is( ":hidden" ) ? "show" : "hide";
}
return mode;
},
// Translates a [top,left] array into a baseline value
// this should be a little more flexible in the future to handle a string & hash
- getBaseline: function( origin, original ) {
+ getBaseline: function( origin, original ) {
var y, x;
switch ( origin[ 0 ] ) {
- case 'top': y = 0; break;
- case 'middle': y = 0.5; break;
- case 'bottom': y = 1; break;
+ case "top": y = 0; break;
+ case "middle": y = 0.5; break;
+ case "bottom": y = 1; break;
default: y = origin[ 0 ] / original.height;
};
switch ( origin[ 1 ] ) {
- case 'left': x = 0; break;
- case 'center': x = 0.5; break;
- case 'right': x = 1; break;
+ case "left": x = 0; break;
+ case "center": x = 0.5; break;
+ case "right": x = 1; break;
default: x = origin[ 1 ] / original.width;
};
return {
@@ -362,7 +392,7 @@ $.extend( $.effects, {
createWrapper: function( element ) {
// if the element is already wrapped, return it
- if ( element.parent().is( '.ui-effects-wrapper' )) {
+ if ( element.parent().is( ".ui-effects-wrapper" )) {
return element.parent();
}
@@ -370,14 +400,14 @@ $.extend( $.effects, {
var props = {
width: element.outerWidth(true),
height: element.outerHeight(true),
- 'float': element.css( 'float' )
+ "float": element.css( "float" )
},
- wrapper = $( '<div></div>' )
- .addClass( 'ui-effects-wrapper' )
+ wrapper = $( "<div></div>" )
+ .addClass( "ui-effects-wrapper" )
.css({
- fontSize: '100%',
- background: 'transparent',
- border: 'none',
+ fontSize: "100%",
+ background: "transparent",
+ border: "none",
margin: 0,
padding: 0
});
@@ -386,26 +416,26 @@ $.extend( $.effects, {
wrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element
// transfer positioning properties to the wrapper
- if ( element.css( 'position' ) == 'static' ) {
- wrapper.css({ position: 'relative' });
- element.css({ position: 'relative' });
+ if ( element.css( "position" ) === "static" ) {
+ wrapper.css({ position: "relative" });
+ element.css({ position: "relative" });
} else {
$.extend( props, {
- position: element.css( 'position' ),
- zIndex: element.css( 'z-index' )
+ position: element.css( "position" ),
+ zIndex: element.css( "z-index" )
});
- $.each([ 'top', 'left', 'bottom', 'right' ], function(i, pos) {
+ $.each([ "top", "left", "bottom", "right" ], function(i, pos) {
props[ pos ] = element.css( pos );
if ( isNaN( parseInt( props[ pos ], 10 ) ) ) {
- props[ pos ] = 'auto';
+ props[ pos ] = "auto";
}
});
element.css({
- position: 'relative',
+ position: "relative",
top: 0,
left: 0,
- right: 'auto',
- bottom: 'auto'
+ right: "auto",
+ bottom: "auto"
});
}
@@ -413,7 +443,7 @@ $.extend( $.effects, {
},
removeWrapper: function( element ) {
- if ( element.parent().is( '.ui-effects-wrapper' ) )
+ if ( element.parent().is( ".ui-effects-wrapper" ) )
return element.parent().replaceWith( element );
return element;
},
@@ -452,7 +482,7 @@ function _normalizeArguments( effect, options, speed, callback ) {
}
// catch (effect, speed, ?)
- if ( $.type( options ) == 'number' || $.fx.speeds[ options ]) {
+ if ( $.type( options ) === "number" || $.fx.speeds[ options ]) {
callback = speed;
speed = options;
options = {};
@@ -468,9 +498,9 @@ function _normalizeArguments( effect, options, speed, callback ) {
if ( options ) {
$.extend( effect, options );
}
-
+
speed = speed || options.duration;
- effect.duration = $.fx.off ? 0 : typeof speed == 'number'
+ effect.duration = $.fx.off ? 0 : typeof speed === "number"
? speed : speed in $.fx.speeds ? $.fx.speeds[ speed ] : $.fx.speeds._default;
effect.complete = callback || options.complete;
@@ -483,7 +513,7 @@ function standardSpeed( speed ) {
if ( !speed || typeof speed === "number" || $.fx.speeds[ speed ] ) {
return true;
}
-
+
// invalid strings - treat as "normal" speed
if ( typeof speed === "string" && !$.effects.effect[ speed ] ) {
// TODO: remove in 2.0 (#7115)
@@ -492,7 +522,7 @@ function standardSpeed( speed ) {
}
return true;
}
-
+
return false;
}
@@ -538,7 +568,7 @@ $.fn.extend({
return this._show.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
- args.mode = 'show';
+ args.mode = "show";
return this.effect.call( this, args );
}
},
@@ -549,7 +579,7 @@ $.fn.extend({
return this._hide.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
- args.mode = 'hide';
+ args.mode = "hide";
return this.effect.call( this, args );
}
},
@@ -561,7 +591,7 @@ $.fn.extend({
return this.__toggle.apply( this, arguments );
} else {
var args = _normalizeArguments.apply( this, arguments );
- args.mode = 'toggle';
+ args.mode = "toggle";
return this.effect.call( this, args );
}
},
@@ -571,7 +601,7 @@ $.fn.extend({
var style = this.css( key ),
val = [];
- $.each( [ 'em', 'px', '%', 'pt' ], function( i, unit ) {
+ $.each( [ "em", "px", "%", "pt" ], function( i, unit ) {
if ( style.indexOf( unit ) > 0 )
val = [ parseFloat( style ), unit ];
});
@@ -626,7 +656,7 @@ $.fn.extend({
$.easing.jswing = $.easing.swing;
$.extend( $.easing, {
- def: 'easeOutQuad',
+ def: "easeOutQuad",
swing: function ( x, t, b, c, d ) {
return $.easing[ $.easing.def ]( x, t, b, c, d );
},
@@ -707,9 +737,9 @@ $.extend( $.easing, {
a = c;
if ( t == 0 ) return b;
if ( ( t /= d ) == 1 ) return b+c;
- if ( a < Math.abs( c ) ) {
- a = c;
- s = p / 4;
+ if ( a < Math.abs( c ) ) {
+ a = c;
+ s = p / 4;
} else {
s = p / ( 2 * Math.PI ) * Math.asin( c / a );
}
@@ -722,8 +752,8 @@ $.extend( $.easing, {
if ( t == 0 ) return b;
if ( ( t /= d ) == 1 ) return b+c;
if ( a < Math.abs( c ) ) {
- a = c;
- s = p / 4;
+ a = c;
+ s = p / 4;
} else {
s = p / ( 2 * Math.PI ) * Math.asin( c / a );
}
@@ -735,7 +765,7 @@ $.extend( $.easing, {
a = c;
if ( t == 0 ) return b;
if ( ( t /= d / 2 ) == 2 ) return b+c;
- if ( a < Math.abs( c ) ) {
+ if ( a < Math.abs( c ) ) {
a = c;
s = p / 4;
} else {
diff --git a/ui/jquery.ui.button.js b/ui/jquery.ui.button.js
index 031ac2091..e5eedc3e5 100644
--- a/ui/jquery.ui.button.js
+++ b/ui/jquery.ui.button.js
@@ -13,7 +13,7 @@
*/
(function( $, undefined ) {
-var lastActive,
+var lastActive, startXPos, startYPos, clickDragged,
baseClasses = "ui-button ui-widget ui-state-default ui-corner-all",
stateClasses = "ui-state-hover ui-state-active ",
typeClasses = "ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only",
@@ -112,13 +112,36 @@ $.widget( "ui.button", {
if ( toggleButton ) {
this.element.bind( "change.button", function() {
+ if ( clickDragged ) {
+ return;
+ }
self.refresh();
});
+ // if mouse moves between mousedown and mouseup (drag) set clickDragged flag
+ // prevents issue where button state changes but checkbox/radio checked state
+ // does not in Firefox (see ticket #6970)
+ this.buttonElement
+ .bind( "mousedown.button", function( event ) {
+ if ( options.disabled ) {
+ return;
+ }
+ clickDragged = false;
+ startXPos = event.pageX;
+ startYPos = event.pageY;
+ })
+ .bind( "mouseup.button", function( event ) {
+ if ( options.disabled ) {
+ return;
+ }
+ if ( startXPos !== event.pageX || startYPos !== event.pageY ) {
+ clickDragged = true;
+ }
+ });
}
if ( this.type === "checkbox" ) {
this.buttonElement.bind( "click.button", function() {
- if ( options.disabled ) {
+ if ( options.disabled || clickDragged ) {
return false;
}
$( this ).toggleClass( "ui-state-active" );
@@ -126,7 +149,7 @@ $.widget( "ui.button", {
});
} else if ( this.type === "radio" ) {
this.buttonElement.bind( "click.button", function() {
- if ( options.disabled ) {
+ if ( options.disabled || clickDragged ) {
return false;
}
$( this ).addClass( "ui-state-active" );
@@ -185,6 +208,7 @@ $.widget( "ui.button", {
// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can
// be overridden by individual plugins
this._setOption( "disabled", options.disabled );
+ this._resetButton();
},
_determineButtonType: function() {
@@ -250,6 +274,7 @@ $.widget( "ui.button", {
} else {
this.element.removeAttr( "disabled" );
}
+ return;
}
this._resetButton();
},
@@ -352,6 +377,8 @@ $.widget( "ui.buttonset", {
},
refresh: function() {
+ var ltr = this.element.css( "direction" ) === "ltr";
+
this.buttons = this.element.find( this.options.items )
.filter( ":ui-button" )
.button( "refresh" )
@@ -364,10 +391,10 @@ $.widget( "ui.buttonset", {
})
.removeClass( "ui-corner-all ui-corner-left ui-corner-right" )
.filter( ":first" )
- .addClass( "ui-corner-left" )
+ .addClass( ltr ? "ui-corner-left" : "ui-corner-right" )
.end()
.filter( ":last" )
- .addClass( "ui-corner-right" )
+ .addClass( ltr ? "ui-corner-right" : "ui-corner-left" )
.end()
.end();
},
diff --git a/ui/jquery.ui.datepicker.js b/ui/jquery.ui.datepicker.js
index de2df6064..5b1dad684 100644
--- a/ui/jquery.ui.datepicker.js
+++ b/ui/jquery.ui.datepicker.js
@@ -707,7 +707,7 @@ $.extend(Datepicker.prototype, {
var origyearshtml = inst.yearshtml;
setTimeout(function(){
//assure that inst.yearshtml didn't change.
- if( origyearshtml === inst.yearshtml ){
+ if( origyearshtml === inst.yearshtml && inst.yearshtml ){
inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
}
origyearshtml = inst.yearshtml = null;
@@ -1606,14 +1606,9 @@ $.extend(Datepicker.prototype, {
'>' + year + '</option>';
}
inst.yearshtml += '</select>';
- //when showing there is no need for later update
- if( ! $.browser.mozilla ){
- html += inst.yearshtml;
- inst.yearshtml = null;
- } else {
- // will be replaced later with inst.yearshtml
- html += '<select class="ui-datepicker-year"><option value="' + drawYear + '" selected="selected">' + drawYear + '</option></select>';
- }
+
+ html += inst.yearshtml;
+ inst.yearshtml = null;
}
}
html += this._get(inst, 'yearSuffix');
diff --git a/ui/jquery.ui.draggable.js b/ui/jquery.ui.draggable.js
index acc6c7bb3..c16833eb0 100644
--- a/ui/jquery.ui.draggable.js
+++ b/ui/jquery.ui.draggable.js
@@ -436,10 +436,11 @@ $.widget("ui.draggable", $.ui.mouse, {
}
if(o.grid) {
- var top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];
+ //Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)
+ var top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;
pageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;
- var left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];
+ var left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;
pageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;
}