Opened 14 years ago

Closed 13 years ago

Last modified 11 years ago

#5207 closed feature (fixed)

Abstract event binding

Reported by: Jörn Zaefferer Owned by:
Priority: major Milestone: 1.9.0
Component: ui.widget Version: 1.8rc2
Keywords: Cc:
Blocked by: Blocking:

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 (3)

comment:1 Changed 13 years ago by Jörn 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 13 years ago by Scott González

Milestone: 1.next1.9
Resolution: fixed
Status: newclosed

comment:3 Changed 11 years ago by Scott González

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

Note: See TracTickets for help on using tickets.