From: Giovanni Giacobbi Date: Sun, 21 Dec 2014 23:35:24 +0000 (+0100) Subject: Widget: Improve readability in `$.widget.bridge()` X-Git-Tag: 1.12.0-beta.1~469 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=713688dccdfc7eddd596cdd1a3522e2ce9fb9d2a;p=jquery-ui.git Widget: Improve readability in `$.widget.bridge()` Closes gh-1409 --- diff --git a/ui/widget.js b/ui/widget.js index 302705044..0b9362532 100644 --- a/ui/widget.js +++ b/ui/widget.js @@ -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 ) {