Search and Top Navigation
#8658 closed feature (fixed)
Opened October 11, 2012 08:19PM UTC
Closed October 24, 2012 02:42PM UTC
Last modified October 24, 2012 02:43PM UTC
Widget: this._on delegates using instance.widget() instead of passed element
Reported by: | shuoink | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.1 |
Component: | ui.widget | Version: | 1.9.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I have a somewhat complex widget that has multiple drop-down menus that are placed directly under the body tag. I expected to be able to do the following:
this._on(this._menu, {'click button': '_menu_button_click'});
... but this doesn't work and actually causes a good bit of chaos. Every button element in the entire widget (except the desired one) is now bound to
_menu_button_click. This happens because in
$.Widget.prototype._on, it only uses the passed element if there's no selector specified. Here's that code:
if ( selector ) { instance.widget().delegate( selector, eventName, handlerProxy ); } else { element.bind( eventName, handlerProxy ); }
It seems to be that it should be calling
element.delegate, not
instance.widget().delegate.
Am I doing something wrong?
Attachments (0)
Change History (5)
Changed October 11, 2012 08:30PM UTC by comment:1
type: | bug → feature |
---|
Changed October 15, 2012 03:51PM UTC by comment:2
status: | new → open |
---|---|
summary: | this._on delegates using instance.widget() instead of passed element → Widget: this._on delegates using instance.widget() instead of passed element |
Changed October 17, 2012 07:15PM UTC by comment:3
Just committed a fix and submitted a pull request:
Changed October 24, 2012 02:42PM UTC by comment:4
resolution: | → fixed |
---|---|
status: | open → closed |
Widget: Fix _on to use element argument for delegated events. Fixes #8658 - Widget: this._on delegates using instance.widget() instead of passed element
Changeset: 721a4b4ae027b140ca280bbc8fb8ed334081b184
Changed October 24, 2012 02:43PM UTC by comment:5
milestone: | 1.10.0 → 1.9.1 |
---|
We can probably handle this by checking if an element was passed and if so using that.