开发者

replace bindwithevent function in mootools 1.3 (upgrade from 1.2)

开发者 https://www.devze.com 2023-01-21 10:25 出处:网络
Dear all, as MooTools 1.3 is out开发者_运维知识库 now, i´m going to update some scripts. BindWithEvent is now deprecated and has to be replaced, but how?

Dear all, as MooTools 1.3 is out开发者_运维知识库 now, i´m going to update some scripts. BindWithEvent is now deprecated and has to be replaced, but how?

See this:

new Element('div', [.....]).addEvent('click',this.close.bindWithEvent(this,true));

I´m quite sure it has to be some sort of a function

new Element('div', [.....]).addEvent('click',function (event) { ????? } );

But how to bind with the upper close event?


From the docs,

Function method: bindWithEvent

This function has been deprecated.

Example how you could replace this method:

myElement.addEvent('click', function(e){
    myFunction.bind(bind, [e]);
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号