From: Scott González Date: Wed, 24 Oct 2012 14:13:14 +0000 (-0400) Subject: Widget: Use existing widgetEventPrefix when extending. Fixes #8724 - widgetEventPrefi... X-Git-Tag: 1.9.1~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=848ab485839b6dd26f2b6c6680141d95cab32ceb;p=jquery-ui.git Widget: Use existing widgetEventPrefix when extending. Fixes #8724 - widgetEventPrefix is lost when extending existing widget. --- diff --git a/tests/unit/widget/widget_core.js b/tests/unit/widget/widget_core.js index 31f2b9ccf..624ccf743 100644 --- a/tests/unit/widget/widget_core.js +++ b/tests/unit/widget/widget_core.js @@ -1240,6 +1240,21 @@ test( "redefine deep prototype chain", function() { delete $.ui.testWidget2; }); +test( "redefine - widgetEventPrefix", function() { + expect( 2 ); + + $.widget( "ui.testWidget", { + widgetEventPrefix: "test" + }); + equal( $.ui.testWidget.prototype.widgetEventPrefix, "test", + "cusotm prefix in original" ); + + $.widget( "ui.testWidget", $.ui.testWidget, {} ); + equal( $.ui.testWidget.prototype.widgetEventPrefix, "test", + "cusotm prefix in extension" ); + +}); + asyncTest( "_delay", function() { expect( 6 ); var order = 0, diff --git a/ui/jquery.ui.widget.js b/ui/jquery.ui.widget.js index ccbe0cac5..eea12c471 100644 --- a/ui/jquery.ui.widget.js +++ b/ui/jquery.ui.widget.js @@ -101,7 +101,7 @@ $.widget = function( name, base, prototype ) { // TODO: remove support for widgetEventPrefix // always use the name + a colon as the prefix, e.g., draggable:start // don't prefix for widgets that aren't DOM-based - widgetEventPrefix: name + widgetEventPrefix: basePrototype.widgetEventPrefix || name }, prototype, { constructor: constructor, namespace: namespace,