jquery.fileupload-image-editor.js中
_initEventHandlers: function () {
this._super();
var handlers = {};
handlers[this.options.uploadImageEditorPreviewSelector] = this._previewHandler.bind(this);
this._on(this.options.filesContainer, handlers);
},
jquery.ui.widget.js
_on: function( suppressDisabledCheck, element, handlers ) {
var delegateElement,
instance = this;
// no suppressDisabledCheck flag, shuffle arguments
if ( typeof suppressDisabledCheck !== "boolean" ) {
handlers = element;
element = suppressDisabledCheck;
suppressDisabledCheck = false;
}
// no element argument, shuffle and use this.element
if ( !handlers ) {
handlers = element;
element = this.element;
delegateElement = this.widget();
} else {
element = delegateElement = $( element );
this.bindings = this.bindings.add( element );
}
_on( [suppressDisabledCheck ] [, element ], handlers )Returns: jQuery (plugin only)
Binds event handlers to the specified element(s). Delegation is supported via selectors inside the event names, e.g., "click .foo". The _on() method provides several benefits of direct event binding:
Maintains proper this context inside the handlers.
Automatically handles disabled widgets: If the widget is disabled or the event occurs on an element with the ui-state-disabled class, the event handler is not invoked. Can be overridden with the suppressDisabledCheck parameter.
Event handlers are automatically namespaced and cleaned up on destroy.
suppressDisabledCheck (default: false)
Type: Boolean
Whether or not to bypass the disabled check.
element
Type: jQuery
Which element(s) to bind the event handlers to. If no element is provided, this.element is used for non-delegated events and the widget element is used for delegated events.
handlers
Type: Object
An object in which the keys represent the event type and optional selector for delegation, and the values represent a handler function to be called for the event.
Code examples:
Prevent the default action of all links clicked within the widget's element.
this._on( this.element, {
"click a": function( event ) {
event.preventDefault();
}
});