]> 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>
Wed, 31 Dec 2014 15:50:03 +0000 (10:50 -0500)
Closes gh-1409

ui/widget.js

index 30270504437261c26a40027a65c3232be895479c..0b93625323ba1f21c10566e942d2210046190562 100644 (file)
@@ -195,11 +195,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,
@@ -224,6 +219,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 ) {