jQuery in firefox extension

谁都会走 提交于 2020-01-24 19:09:08

问题


I was creating a firefox extension. and I am including the jquery in the xul file as

    <script type="application/x-javascript" src="libs/project/libs/jquery.js" />

followed by some other files which uses jquery

    <script type="application/x-javascript" src="sample.js" />
    <script type="application/x-javascript" src="sample2.js" />
                     .
                     .
                     .

but here I am getting some errors like

  • ReferenceError: jQuery is not defined

  • TypeError: a is undefined

  • ReferenceError: $ is not defined

what should I do ?


回答1:


Possible reason for this is this bug: http://bugs.jquery.com/ticket/12357

JQUERY 1.8.0 NOT PARSEABLE BY XUL RUNNER APPLICATIONS

You can test this by setting up a simple xul runner window and including jQuery, then alert the typeof jQuery or $ which will result in a response of undefined.

If you paste the jQuery code into a script tag in the XUL main window, you will be able to see all the various parsing issues that have been released in this build.



来源:https://stackoverflow.com/questions/13960797/jquery-in-firefox-extension

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