I'm trying to make some Drupal 7 content updated by jQuery's load()
and it's not being processed by the relevant JS code. The code in question uses bind()
and is spread over dozens of Drupal core JS files.
I want to workaround this by using jQuery 1.7.1 and changing
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
to behave as
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
The only thing missing is selector
as you can see. Can I somehow get it from the standard bind()
calls?
You could try something like
function(types, data, fn) {
(this.context
? $(this.context)
: this ).on(types, this.selector || null, data, fn);
return this;
}
as every jQuery object holds the current selectors and context elements as properties.
However, you should not apply that workaround by overwriting .bind
with the delegate
funcionality, it will only introduce bugs into your application. Better change your code which invokes bind but shouldn't.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.