Ticket #5207 (closed feature: fixed)

Opened 3 years ago

Last modified 11 months ago

Abstract event binding

Reported by: joern.zaefferer Owned by:
Priority: major Milestone: 1.9.0
Component: ui.widget Version: 1.8rc2
Keywords: Cc:
Blocking: Blocked by:

Description

Something like this should be added in 1.9:

$.widget.prototype._bind = function(elements, handlers) {
    if (!handlers) {
        handlers = elements;
        elements = this.element;
    }
    var self = this,
    $.each(handlers), function(event, handler) {
        elements.bind(event, function() {
          if (!self.options.disabled) { return fn.apply(self, arguments); }
        }
    });
}

In addition, track all events bound (at least those bind to something else then element) and unbind them in destroy.

Change History

comment:1 Changed 3 years ago by joern.zaefferer

Branch for this ticket:  http://github.com/jquery/jquery-ui/commits/bind

We shouldn't have merged 1.8.1 into that branch. Can't find the one commit to the branch...

comment:2 Changed 2 years ago by scott.gonzalez

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from 1.next to 1.9

comment:3 Changed 11 months ago by scott.gonzalez

See #7795, where _bind() was renamed to _on().

Note: See TracTickets for help on using tickets.