且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在加载脚本之前执行的Modernizr.load回调

更新时间:2023-12-04 22:59:22

在对该主题进行了一些研究之后,我认为这个问题可能比起初看起来更普遍,但由于它与上下文有关而被忽略了,并且有不同的描述方式:

After doing some research on the subject, I think this issue may be more common than it seems at first, but has been overlooked because it is context dependent, and has different ways of being described:

Modernizr加载[A,B]似乎在A之前执行了B,这怎么可能?

YepNopeJS:回调在之前触发微小的JS文件已完全加载

https://github.com/SlexAxton/yepnope.js/issues/195

阅读此不错的文章(在yepnope页面上引用),关于IE上遇到的不一致之处,我想出了一个修复程序,该修复程序已通过github发送给yepnope维护者:

After reading this nice article (referenced on yepnope page), about the inconsistencies experienced on IE, I came up with a fix, which has been sent to yepnope maintainers via github:

http://github.com/SlexAxton/yepnope.js/pull/196

我不知道它是否会被接受,但是它解决了我的问题.

I don't know whether it is going to be accepted or not, but it solved my problem.

由于编辑库可能并不总是一个好主意,因此我建议采取以下解决方法:

As editing a library may not always be a good idea, I would suggest the following workaround:

//instead of
complete:function(){
    doStuff()
}
//try
complete:function(){
    setTimeout(doStuff, 0);
}