From: Alexander Schmitz Date: Wed, 31 Jul 2013 19:56:04 +0000 (-0400) Subject: Widget Factory: Make $.widget return the constructor. Fixes #9467 - Widget factory... X-Git-Tag: 1.11.0-beta.1~275 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c0ab71056b936627e8a7821f03c044aec6280a40;p=jquery-ui.git Widget Factory: Make $.widget return the constructor. Fixes #9467 - Widget factory: Return the constructor from $.widget(). --- diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 3268b756d..aff07cc35 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -615,12 +615,13 @@ test( ".disable()", function() { }); test( ".widget() - base", function() { - expect( 1 ); - $.widget( "ui.testWidget", { + expect( 2 ); + var constructor = $.widget( "ui.testWidget", { _create: function() {} }); var div = $( "
" ).testWidget(); deepEqual( div[0], div.testWidget( "widget" )[0]); + deepEqual( constructor, $.ui.testWidget, "$.widget returns the constructor" ); }); test( ".widget() - overriden", function() { diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index 93daaf1ca..885e2019f 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -134,6 +134,8 @@ $.widget = function( name, base, prototype ) { } $.widget.bridge( name, constructor ); + + return constructor; }; $.widget.extend = function( target ) {