From 69bd7a7a75015a63dafe8b284c2a0c3af9d649ee Mon Sep 17 00:00:00 2001 From: Giovanni Giacobbi Date: Mon, 22 Dec 2014 00:35:24 +0100 Subject: [PATCH] Widget: Improve readability in `$.widget.bridge()` Closes gh-1409 (cherry picked from commit 713688dccdfc7eddd596cdd1a3522e2ce9fb9d2a) --- ui/widget.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 ) { -- 2.39.5