mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Widget: Only use the event prefix from the base if we're redefining a widget. Fixes #8805 - Widget: widgetEventPrefix is incorrect when inheriting with jQuery UI 1.9.1.
(cherry picked from commit 9e858ba14a
)
This commit is contained in:
parent
41ec41126d
commit
e27195ba44
@ -332,8 +332,8 @@ test( "re-init", function() {
|
|||||||
deepEqual( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" );
|
deepEqual( actions, [ "optionfoo", "init" ], "correct methods called on re-init with options" );
|
||||||
});
|
});
|
||||||
|
|
||||||
test( "inheritance - options", function() {
|
test( "inheritance", function() {
|
||||||
expect( 4 );
|
expect( 6 );
|
||||||
// #5830 - Widget: Using inheritance overwrites the base classes options
|
// #5830 - Widget: Using inheritance overwrites the base classes options
|
||||||
$.widget( "ui.testWidgetBase", {
|
$.widget( "ui.testWidgetBase", {
|
||||||
options: {
|
options: {
|
||||||
@ -354,6 +354,8 @@ test( "inheritance - options", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
equal( $.ui.testWidgetBase.prototype.widgetEventPrefix, "testWidgetBase",
|
||||||
|
"base class event prefix" );
|
||||||
deepEqual( $.ui.testWidgetBase.prototype.options.obj, {
|
deepEqual( $.ui.testWidgetBase.prototype.options.obj, {
|
||||||
key1: "foo",
|
key1: "foo",
|
||||||
key2: "bar"
|
key2: "bar"
|
||||||
@ -361,6 +363,8 @@ test( "inheritance - options", function() {
|
|||||||
deepEqual( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ],
|
deepEqual( $.ui.testWidgetBase.prototype.options.arr, [ "testing" ],
|
||||||
"base class option array not overridden");
|
"base class option array not overridden");
|
||||||
|
|
||||||
|
equal( $.ui.testWidgetExtension.prototype.widgetEventPrefix, "testWidgetExtension",
|
||||||
|
"extension class event prefix" );
|
||||||
deepEqual( $.ui.testWidgetExtension.prototype.options.obj, {
|
deepEqual( $.ui.testWidgetExtension.prototype.options.obj, {
|
||||||
key1: "baz",
|
key1: "baz",
|
||||||
key2: "bar"
|
key2: "bar"
|
||||||
|
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: basePrototype.widgetEventPrefix || name
|
widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
|
||||||
}, prototype, {
|
}, prototype, {
|
||||||
constructor: constructor,
|
constructor: constructor,
|
||||||
namespace: namespace,
|
namespace: namespace,
|
||||||
|
Loading…
Reference in New Issue
Block a user