Ticket #5743 (closed bug: fixed)
$.fn.remove does not trigger remove event for <select>s
| Reported by: | sciyoshi | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.8.3 |
| Component: | ui.widget | Version: | 1.8.2 |
| Keywords: | select, option, remove, widget, dropdown | Cc: | sciyoshi@… |
| Blocking: | Blocked by: |
Description
Minimal test case:
$('<select><option>Option</option></select>')
.appendTo('body')
.bind('remove', function() {
alert('This dialog should show...');
})
.remove();
This code used to work with jQuery 1.3 but no longer works with 1.4, breaking certain widgets that are meant to be attached to <select> elements (in my case, jquery-dropdownchecklist).
The bug is caused by behaviour changed in jQuery 1.4: $.makeArray (called by $.fn.add) now checks for a length property, which a <select> DOM element will have.
Change History
comment:2 Changed 3 years ago by scott.gonzalez
- Status changed from new to closed
- Resolution set to fixed
- Milestone changed from TBD to 1.9
Fixed in 89c0961. Thanks sciyoshi.
comment:4 Changed 3 years ago by Samuel Cormier-Iijima
Core (widget): don't pass DOM objects to $.fn.add. Fixes #5743 ($.fn.remove does not trigger remove event for <select>s)
Changeset: 89c0961c3849db0d804b337f2d438c822074b112
Note: See
TracTickets for help on using
tickets.


Fixed in my github fork - commit can be found at http://github.com/sciyoshi/jquery-ui/commit/53982e7be3da866b883500fcc1f48645b0398d77