Ticket #5743 (closed bug: fixed)

Opened 5 years ago

Last modified 4 years ago

$.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:1 Changed 5 years ago by sciyoshi

comment:2 Changed 4 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:3 Changed 4 years ago by scott.gonzalez

  • Milestone changed from 1.9 to 1.8.3

comment:4 Changed 4 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.