Skip to content

Commit

Permalink
Widget: Improve readability in $.widget.bridge()
Browse files Browse the repository at this point in the history
Closes gh-1409
  • Loading branch information
thg2k authored and scottgonzalez committed Dec 31, 2014
1 parent b6bec79 commit 713688d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ui/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 ) {
Expand Down

0 comments on commit 713688d

Please sign in to comment.