Skip to main content

Search and Top Navigation

#5207 closed feature (fixed)

Opened February 21, 2010 01:05PM UTC

Closed February 01, 2011 11:05AM UTC

Last modified June 14, 2012 04:36PM UTC

Abstract event binding

Reported by: jzaefferer 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.

Attachments (0)
Change History (3)

Changed July 30, 2010 12:33PM UTC by jzaefferer comment:1

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...

Changed February 01, 2011 11:05AM UTC by scottgonzalez comment:2

milestone: 1.next1.9
resolution: → fixed
status: newclosed

Added in 659db70caa2ff1e3a43e98f3895f0353ebcee154 and 6072703cd17a04b0de83b337534fd0c12e24aa88.

Changed June 14, 2012 04:36PM UTC by scottgonzalez comment:3

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