admin管理员组文章数量:1405553
I am using a plugin that has this block of code. However i am getting this error
JQMIGRATE: jQuery.event.handle is undocumented and deprecated
*Cause: jQuery.event.handle was never documented, and deprecated with jQuery 1.7 (see ). As of jQuery 1.9, it has been removed.
Solution: Use documented jQuery APIs, such as .trigger
.*
handler: function( event, execAsap ) {
// Save the context
var context = this,
args = arguments;
// set correct event type
event.type = "smartresize";
if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
resizeTimeout = setTimeout(function() {
jQuery.event.handle.apply( context, args ); //here
}, execAsap === "execAsap"? 0 : 50 );
}
So, this line will be changed to what?
jQuery.event.handle.apply( context, args );
I am using a plugin that has this block of code. However i am getting this error
JQMIGRATE: jQuery.event.handle is undocumented and deprecated
*Cause: jQuery.event.handle was never documented, and deprecated with jQuery 1.7 (see http://forum.jquery./topic/deprecated-event-properties-used-in-jquery). As of jQuery 1.9, it has been removed.
Solution: Use documented jQuery APIs, such as .trigger
.*
handler: function( event, execAsap ) {
// Save the context
var context = this,
args = arguments;
// set correct event type
event.type = "smartresize";
if ( resizeTimeout ) { clearTimeout( resizeTimeout ); }
resizeTimeout = setTimeout(function() {
jQuery.event.handle.apply( context, args ); //here
}, execAsap === "execAsap"? 0 : 50 );
}
So, this line will be changed to what?
jQuery.event.handle.apply( context, args );
Share
Improve this question
asked Jun 13, 2013 at 22:35
anvdanvd
4,05720 gold badges71 silver badges129 bronze badges
2
-
What plugin? I guess
context
must be the element and args the arguments passed into that custom event, so something like this$(this).trigger(event, [args])
maybe? – elclanrs Commented Jun 13, 2013 at 22:38 - @elclanrs, you are correct. please add as an answer. link – anvd Commented Jun 13, 2013 at 22:42
2 Answers
Reset to default 4I'm guessing context
must be the element and args
the arguments passed into that custom event, so maybe something like this should work:
$(this).trigger(event, [args]);
I would suggest refactoring the whole thing to use on
instead of bind
. Then you can trigger
custom events defined with on
very easily, I don't think using this approach you need to define a custom event so you could make the code a bit smaller.
http://api.jquery./on/
you could try this: instead of
jQuery.event.handle.apply( context, args );
to use
jQuery.event.dispatch.apply( context, args );
this will work fine...
本文标签: javascriptjQueryeventhandle is undocumented and deprecatedStack Overflow
版权声明:本文标题:javascript - jQuery.event.handle is undocumented and deprecated - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744247153a2597073.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论