Skip to content

Commit

Permalink
Effects: Remove deprecated $.effects[]. Fixes #7115 - Effects: Remove…
Browse files Browse the repository at this point in the history
… support for effects in $.effects[].
  • Loading branch information
jzaefferer committed Oct 25, 2012
1 parent 7678b90 commit b8e0de2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 35 deletions.
3 changes: 0 additions & 3 deletions tests/unit/effects/effects.html
Expand Up @@ -5,9 +5,6 @@
<title>jQuery UI Effects Test Suite</title> <title>jQuery UI Effects Test Suite</title>


<script src="../../jquery.js"></script> <script src="../../jquery.js"></script>
<script>
$.uiBackCompat = false;
</script>
<link rel="stylesheet" href="../../../external/qunit.css"> <link rel="stylesheet" href="../../../external/qunit.css">
<script src="../../../external/qunit.js"></script> <script src="../../../external/qunit.js"></script>
<script src="../../jquery.simulate.js"></script> <script src="../../jquery.simulate.js"></script>
Expand Down
3 changes: 1 addition & 2 deletions ui/jquery.ui.datepicker.js
Expand Up @@ -693,8 +693,7 @@ $.extend(Datepicker.prototype, {
inst.dpDiv.zIndex($(input).zIndex()+1); inst.dpDiv.zIndex($(input).zIndex()+1);
$.datepicker._datepickerShowing = true; $.datepicker._datepickerShowing = true;


// DEPRECATED: after BC for 1.8.x $.effects[ showAnim ] is not needed if ( $.effects && $.effects.effect[ showAnim ] )
if ( $.effects && ( $.effects.effect[ showAnim ] || $.effects[ showAnim ] ) )
inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess); inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
else else
inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess); inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
Expand Down
34 changes: 5 additions & 29 deletions ui/jquery.ui.effect.js
Expand Up @@ -10,9 +10,7 @@
*/ */
;(jQuery.effects || (function($, undefined) { ;(jQuery.effects || (function($, undefined) {


var backCompat = $.uiBackCompat !== false, var dataSpace = "ui-effects-";
// prefix used for storing data on .data()
dataSpace = "ui-effects-";


$.effects = { $.effects = {
effect: {} effect: {}
Expand Down Expand Up @@ -1099,28 +1097,17 @@ function standardSpeed( speed ) {
} }


// invalid strings - treat as "normal" speed // invalid strings - treat as "normal" speed
if ( typeof speed === "string" && !$.effects.effect[ speed ] ) { return typeof speed === "string" && !$.effects.effect[ speed ];
// TODO: remove in 2.0 (#7115)
if ( backCompat && $.effects[ speed ] ) {
return false;
}
return true;
}

return false;
} }


$.fn.extend({ $.fn.extend({
effect: function( /* effect, options, speed, callback */ ) { effect: function( /* effect, options, speed, callback */ ) {
var args = _normalizeArguments.apply( this, arguments ), var args = _normalizeArguments.apply( this, arguments ),
mode = args.mode, mode = args.mode,
queue = args.queue, queue = args.queue,
effectMethod = $.effects.effect[ args.effect ], effectMethod = $.effects.effect[ args.effect ];


// DEPRECATED: remove in 2.0 (#7115) if ( $.fx.off || !effectMethod ) {
oldEffectMethod = !effectMethod && backCompat && $.effects[ args.effect ];

if ( $.fx.off || !( effectMethod || oldEffectMethod ) ) {
// delegate to the original method (e.g., .show()) if possible // delegate to the original method (e.g., .show()) if possible
if ( mode ) { if ( mode ) {
return this[ mode ]( args.duration, args.complete ); return this[ mode ]( args.duration, args.complete );
Expand Down Expand Up @@ -1156,18 +1143,7 @@ $.fn.extend({
} }
} }


// TODO: remove this check in 2.0, effectMethod will always be true return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
if ( effectMethod ) {
return queue === false ? this.each( run ) : this.queue( queue || "fx", run );
} else {
// DEPRECATED: remove in 2.0 (#7115)
return oldEffectMethod.call(this, {
options: args,
duration: args.duration,
callback: args.complete,
mode: args.mode
});
}
}, },


_show: $.fn.show, _show: $.fn.show,
Expand Down
2 changes: 1 addition & 1 deletion ui/jquery.ui.widget.js
Expand Up @@ -491,7 +491,7 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
if ( options.delay ) { if ( options.delay ) {
element.delay( options.delay ); element.delay( options.delay );
} }
if ( hasOptions && $.effects && ( $.effects.effect[ effectName ] || $.uiBackCompat !== false && $.effects[ effectName ] ) ) { if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) {
element[ method ]( options ); element[ method ]( options );
} else if ( effectName !== method && element[ effectName ] ) { } else if ( effectName !== method && element[ effectName ] ) {
element[ effectName ]( options.duration, options.easing, callback ); element[ effectName ]( options.duration, options.easing, callback );
Expand Down

0 comments on commit b8e0de2

Please sign in to comment.