Ticket #8724 (closed bug: fixed)

Opened 23 months ago

Last modified 23 months ago

widgetEventPrefix is lost when extending existing widget

Reported by: nix Owned by:
Priority: minor Milestone: 1.9.1
Component: ui.widget Version: 1.9.0
Keywords: Cc:
Blocking: Blocked by:

Description

Tested with dcb671539286dcc58b7e6ffa6035c647500e699a:

$.widget( "foo.bar", {
  widgetEventPrefix: "baz",

  ...
  _someMethod: function() {
    ...
    this._trigger( "event" );
    ...
  },
});
$.widget( "foo.bar", $.foo.bar, {
  ...
  _someOtherMethod: function() {
    ...
  }
  ...
});

When a widget is declared like this, the widgetEventPrefix is lost when the extension is applied. You can re-add it with an additional

$.widget( "foo.bar", $.foo.bar, {
  widgetEventPrefix: "baz"
});

after the declaration of the first extension. Nevertheless, the original should be preserved after the first extension is added, otherwise it's impossible to create optional extensions.

Here's a jsbin with a simple example:  http://jsbin.com/uguxuw/4/edit

Change History

comment:1 Changed 23 months ago by nix

It might also be worth looking at whether other items besides widgetEventPrefix are also lost in the extension process.

comment:2 Changed 23 months ago by Scott González

  • Status changed from new to closed
  • Resolution set to fixed

Widget: Use existing widgetEventPrefix when extending. Fixes #8724 - widgetEventPrefix is lost when extending existing widget.

Changeset: 848ab485839b6dd26f2b6c6680141d95cab32ceb

comment:3 Changed 23 months ago by scott.gonzalez

  • Version changed from git to 1.9.0
  • Milestone changed from 1.10.0 to 1.9.1
Note: See TracTickets for help on using tickets.