]> source.dussan.org Git - jquery-ui.git/commitdiff
Widget: Use existing widgetEventPrefix when extending. Fixes #8724 - widgetEventPrefi...
authorScott González <scott.gonzalez@gmail.com>
Wed, 24 Oct 2012 14:13:14 +0000 (10:13 -0400)
committerScott González <scott.gonzalez@gmail.com>
Wed, 24 Oct 2012 14:13:51 +0000 (10:13 -0400)
tests/unit/widget/widget_core.js
ui/jquery.ui.widget.js

index 31f2b9ccffcb0f0d08fcb1ccbe6aa2c6806e9727..624ccf74355b7ccccb4c41e1fac901026461a735 100644 (file)
@@ -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,
index ccbe0cac58f6b10e37fdacc157f815bf1513b610..eea12c471f9470e9ac072fed2c65dbd1d534fa5d 100644 (file)
@@ -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,