Refactoring for performance

The performance is too slow. when there are many elements and resizing the window by dragging.
So I was refactoring to handle caching of style.

test.html and test.before.html

Test please. thanks :-)