Jquery+Plugins randomly crashes on load
This happens about in about 40-60% of loads, both in FF and chrome, though slightly differently. I'm somewhat new to js, and have no clue to why this would happen randomly. Any ideas?
Here's one readout, they vary.. Usually jquery-min and/or jquery ui are listed as culprits..
Uncaught SyntaxError: Unexpected string
:3000/public/javascripts/app.js:34Uncaught TypeError: Object #<an Object> has no method 'draggable'
:3000/public/javascripts/jquery-1.4.2.min.js:143Uncaught TypeError: undefined is not a function
chrome-extension://pgphcomnlaojlmmcjmiddhdapjpbgeoc/mailto.js:55Got message from bg page - https://mail.google.com/mail/?view=cm&fs=1&tf=1
chrome-extension://pgphcomnlaojlmmcjmiddhdapjpbgeoc/mailto.js:24Starting to rewrite mailtos
invalid label
[Break on this error] ing").height(e);c._tent.outerWidth(),h...g;var l=this,j;this.handles.each(funct
jquery....min.js (line 199)
I'm running node.js, express, jquery, jquery ui and mousewheel.js for jquery. Any idea wh开发者_JS百科y the errors keep changing?
I don't think it's possible to answer this question without seeing your code, almost in it's entirety. Just a thought though, what order have you got your includes in the <head>
of your document?
Should be (if just using jQuery, for example)
- jquery
- jquery ui
- other plugins
- your code
Have you checked whether jQuery and node.js conflict? A good way to approach doing that is to implement functionality from one library first, then start adding functionality / plugins from another library bit by bit - then you'll see where it breaks and can investigate further. But as I said, very difficult to exactly determine the problem without seeing and testing your code.
In relation to
have no clue to why this would happen randomly
well, JS errors, if there's a lot of them and some of them are fundamental (like library conflicts), will look random, because a lot of functions are trying to execute and so the error that your debugging catches may be different each time.
Jquery 1.4.2 and jquery UI 1.8 are not stable releases and this appears to be a bug. The newer versions perform smoother and better but the errors always involved those two libraries. Downgrading removes the issue, but costs performance, not as smooth etc.
精彩评论