From: Giovanni Giacobbi Date: Sun, 21 Dec 2014 23:35:24 +0000 (+0100) Subject: Widget: Improve readability in `$.widget.bridge()` X-Git-Tag: 1.11.3~17 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=69bd7a7a75015a63dafe8b284c2a0c3af9d649ee;p=jquery-ui.git Widget: Improve readability in `$.widget.bridge()` Closes gh-1409 (cherry picked from commit 713688dccdfc7eddd596cdd1a3522e2ce9fb9d2a) --- diff --git a/ui/widget.js b/ui/widget.js index 41425b1a9..8fbce2bf2 100644 --- a/ui/widget.js +++ b/ui/widget.js @@ -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 ) {