-
Bug
-
Resolution: Fixed
-
Normal
-
5.0.13
-
Security Level: Jimmy
-
None
Steps to Reproduce
https://zkfiddle.org/sample/3okm2g5/1-update-styles-performance
click anywhere on the screen
Current Result
it takes 4.3sec (with profiler enabled) to update the inline styles
most of the time is spent clearing the old styles (inefficiently)
Expected Result
evaluate whether this can be improved
Debug Information
the inner loop is iterating over each possible CSS attribute (using for...in) mostly doing nothing
clearing the existing inline styles might be done as shown in the workraround
Workaround
removes the clearStyles overhead almost completely (however there might be a reason for the previous, more complex implementation)
zjq.prototype.clearStyles = function() { this.jq[0].style.cssText = null; return this; }