I have developed a web site using JQuery and a lot of drag-and-drop elements which is working pretty well.
Nevertheless, on IE9 and when a lot of drag and drop elements are dynamically loaded (using .load()) and displayed, the browser is always consuming a small charge of CPU (~10%) (for refreshing?) even if nothing is done by the user for a long time without touch the mouse or scroll on the page.
I don't have any timer, and the behaviour on Chrome and Safari is OK.
Here is the context and what I discovered after my tests:
Context
In my main web page, I load the user views into a div using a load() function. The loaded views contain several containers with draggable elements. These containers are droppables and are refreshing after each drop event using also a load() function.
- If I insert 50
<br>
tags in first in my web page, the graphic elements are not displayed without scroling in my page : my CPU utilization = 0% - When I scroll to display only the half of my view containing the graphic elements, my CPU utilization = 10%
- When all my graphic elements are displayed : my CPU utilization = 20%
- When I reduce my windows size : my CPU utilization decrease according to the window size
Anyone could explain why? Give me an advice? Is it due to a lot of JQuery events? Any solution to spy which part of my code is taking CPU resource?
Any advice are welcome!
Edit
When I remove all JQuery events in my loaded view (click, mouseover, ...) and all JQueryUI elements declaration (.draggable(), .droppable()) the CPU utilization is still here.
But keep in mind that the view is always loaded dynamically using .load() function. FYI, I tried also to load my view with $.post().
I tried this morning with the new JQuery version 1.8.0 and JQueryUI 1.8.22 but this doesn't change anything.