Javascript ComputedStyle: getPropertyValue () is slower in IE. Is there a fix?

My javascript goes through the DOM of the webpage and for each node gets the computed style:

var computedStyle =  window.getComputedStyle(element);

He then uses this to get about 20 values, for example:

c_style = computedStyle.getPropertyValue("height");

This proves the slowness of work in IE (tested IE11 and IE9).

If I just get getComputedStyle style, the time for the page is 0.3 seconds (the script also does other things).

If I add to getPropertyValue, the time for the page increases to 3 full seconds. However, in Firefox it makes little difference that the script is also looking for these values.

Is there any other way to do this in IE (9+)? Or is something else wrong?

EDIT: Did others succeed (= good performance) by getting many styles from IE?

+4

Source: https://habr.com/ru/post/1542034/


All Articles