r2697 - Effects core: Refactored .effect() method; now uses _normalizeArguments and honors jQuery...

r2697 - Effects core: Refactored .effect() method; now uses _normalizeArguments and honors jQuery...


Author: scott.gonzalez
Date: Thu Jun 11 06:06:20 2009
New Revision: 2697
Modified:
trunk/ui/effects.core.js
Log:
Effects core: Refactored .effect() method; now uses _normalizeArguments and
honors jQuery.fx.off. Fixes #4328 (IE6 with fx.off and highlight throws a
script error).
Modified: trunk/ui/effects.core.js
==============================================================================
--- trunk/ui/effects.core.js    (original)
+++ trunk/ui/effects.core.js    Thu Jun 11 06:06:20 2009
@@ -167,8 +167,17 @@
    _toggleClass: $.fn.toggleClass,
    // New effect methods
-    effect: function(fx, options, speed, callback) {
-        return $.effects[fx] ? $.effects[fx].call(this, {method: fx, options:
options || {}, duration: speed, callback: callback }) : null;
+    effect: function(effect, options, speed, callback) {
+        var args = _normalizeArguments.apply(this, arguments),
+            // TODO: make effects takes actual parameters instead of a hash
+            args2 = {
+                options: args[1],
+                duration: args[2],
+                callback: args[3]
+            },
+            effectMethod = $.effects[effect];
+        
+        return effectMethod && !$.fx.off ? effectMethod.call(this, args2) : this;
    },
    show: function(speed) {