mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Widget: Use existing widgetEventPrefix when extending. Fixes #8724 - widgetEventPrefix is lost when extending existing widget.
This commit is contained in:
parent
ba752cf7ed
commit
848ab48583
@ -1240,6 +1240,21 @@ test( "redefine deep prototype chain", function() {
|
|||||||
delete $.ui.testWidget2;
|
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() {
|
asyncTest( "_delay", function() {
|
||||||
expect( 6 );
|
expect( 6 );
|
||||||
var order = 0,
|
var order = 0,
|
||||||
|
2
ui/jquery.ui.widget.js
vendored
2
ui/jquery.ui.widget.js
vendored
@ -101,7 +101,7 @@ $.widget = function( name, base, prototype ) {
|
|||||||
// TODO: remove support for widgetEventPrefix
|
// TODO: remove support for widgetEventPrefix
|
||||||
// always use the name + a colon as the prefix, e.g., draggable:start
|
// always use the name + a colon as the prefix, e.g., draggable:start
|
||||||
// don't prefix for widgets that aren't DOM-based
|
// don't prefix for widgets that aren't DOM-based
|
||||||
widgetEventPrefix: name
|
widgetEventPrefix: basePrototype.widgetEventPrefix || name
|
||||||
}, prototype, {
|
}, prototype, {
|
||||||
constructor: constructor,
|
constructor: constructor,
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
|
Loading…
Reference in New Issue
Block a user