开发者

Loading jquery.jstree.js using requireJS doens't work in IE

开发者 https://www.devze.com 2023-03-25 12:51 出处:网络
Loading jquery.jstree.js using requireJS doens\'t work in IE. When I try to load the JSTree plugin (jquery.jstree.js) using requireJS it fails in IE8 with follwing JS error.

Loading jquery.jstree.js using requireJS doens't work in IE.

When I try to load the JSTree plugin (jquery.jstree.js) using requireJS it fails in IE8 with follwing JS error.

Message: Could not get the type propert开发者_JS百科y. Invalid argument.
Line: 109
Char: 463
Code: 0
URI: file:///...../js/requireplugins-jquery-1.4.3.js

I have tested it in other browsers (FF and Chrome) and it works fine there. Also, it works fine in IE for other jQuery plugins, it's only for the jsTree plugin that it's giving a problem

some code snippets below

I have a test.html where I load requrejs specifying the data-main attribute.    
<script type="text/javascript" data-main="main" src="js/requireplugins-jquery-1.4.3.js"></script>

A main.js where I define all the modules to be loaded and a callback - I have shown 
only the jstree module here as that's the only one causing a problem.
main.js:
require(["jquery.jstree"], callBackFunctionToInitialzeTree);


I've found debugging require.js to be a little tricky--especially when I'm not including the scripts in the right order. I've done the following which isn't a direct answer but may help you track it down...

1) put a console.log line in require-jquery.js just before call to execCb to trace out the fullName of the module that it's loading. In the version I'm using (require-jquery from the main require.js website, it's line 500ish). I've not seen the version that you're using (requireplugins-jquery.1.4.3) so i'm not sure the line number you need.

2) you may find you need to use the "order!" plugin if you have multiple file dependencies that need to have others loaded first (i noticed jstree has a dependency on jquery.cookie and jquery.hotkey). http://requirejs.org/docs/api.html#order

If you can add more detail I'll try to help more.

GL.


I have the same issue with jstree.js & require.js. I change the include order (jstree first then requirejs) and my problem has been solved.

0

精彩评论

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