]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Improve readability in `$.widget.bridge()`
authorGiovanni Giacobbi <giovanni@giacobbi.net>
Sun, 21 Dec 2014 23:35:24 +0000 (00:35 +0100)
committerScott González <scott.gonzalez@gmail.com>
Mon, 9 Feb 2015 16:51:52 +0000 (11:51 -0500)
Closes gh-1409
(cherry picked from commit 713688dccdfc7eddd596cdd1a3522e2ce9fb9d2a)

ui/widget.js

index 41425b1a9d3ea8ea6ea3d5a1f84b56fed2be0b8c..8fbce2bf2746543cbbab88fcbf25348960c6e3f0 100644 (file)
@@ -190,11 +190,6 @@ $.widget.bridge = function( name, object ) {
                        args = widget_slice.call( arguments, 1 ),
                        returnValue = this;
 
-               // allow multiple hashes to be passed on init
-               options = !isMethodCall && args.length ?
-                       $.widget.extend.apply( null, [ options ].concat(args) ) :
-                       options;
-
                if ( isMethodCall ) {
                        this.each(function() {
                                var methodValue,
@@ -219,6 +214,12 @@ $.widget.bridge = function( name, object ) {
                                }
                        });
                } else {
+
+                       // Allow multiple hashes to be passed on init
+                       if ( args.length ) {
+                               options = $.widget.extend.apply( null, [ options ].concat(args) );
+                       }
+
                        this.each(function() {
                                var instance = $.data( this, fullName );
                                if ( instance ) {