Javascript loaders with jQuery

雨燕双飞 提交于 2019-12-23 03:17:35

问题


I'm interested in using a Javascript loader and want to use one which plays nicely with jQuery. I found this comparison table: https://spreadsheets.google.com/lv?key=tDdcrv9wNQRCNCRCflWxhYQ

However, I'd like to get a recommendation from someone with experience with using any of these with jQuery and jQuery UI.

Edit:
The two primary concerns with mixing jQuery and JS loaders are as follows:

  • Will there be a namespace conflict?
  • Will there be any unexpected behavior?

For namespaces, jQuery's documentation covers this extensively.

For unexpected behavior, something you might run into is that the DOM is already in the ready state before jQuery gets loaded in, causing your $(document).ready(handler)s to not fire. You can avoid this by just not using them and assuming your DOM is ready.

If I'm missing others, please comment.

Resources
http://www.nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/


回答1:


In my humble opinion, YUI 3 has the best architecture of any JS framework out there. Their dependency management and dynamic script loading is, therefore, my favorite. I do love jQuery's simplicity and great community so I've used the two together without too much trouble:

Mixing jQuery and YUI together in an app, is it easily possible?



来源:https://stackoverflow.com/questions/5640060/javascript-loaders-with-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!