Has anybody used Dojo and JQuery in the same project?

时光怂恿深爱的人放手 提交于 2019-12-30 04:47:07

问题


Has anybody used Dojo and JQuery in the same project? I need a Dojo object oriented part ( and nothing more ) and JQuery for easier presentation, but I am afraid of collision and name clashes. Is it possible to use both on the same page ?


回答1:


use jQuery.noConflict(); before writing jQuery code block

more information :

http://api.jquery.com/jQuery.noConflict/

read this article too:

http://www.sitepen.com/blog/2010/11/15/from-jquery-to-large-applications/




回答2:


Yes, it is possible and I am doing that right now. I am using Dojo for its framework and JQuery for presentation. It works seamlessly and there shouldn't be any conflicts. Do read the second article mentioned by diEcho.




回答3:


In simple terms, this will work. However, if you use Dojo's AMD you can get issues here.

It turns out that jQuery gets confused if it sees the JS variable 'define.amd' in the page AND it's not an AMD that it knows about or is set up to be using, Especially if it's Dojo's AMD, since that loader has a baseUrl of where Dojo is located on the server and not where JQuery is located.

Hence, the suggestion is to steer clear of Dojo's AMD when using JQuery and Dojo on the same page. Note, handlebarsJS is effected by the same issue.



来源:https://stackoverflow.com/questions/6106368/has-anybody-used-dojo-and-jquery-in-the-same-project

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