Does the offsetHeight of the element have a side effect?

In the code for breaking Bootstrap in the method, hide()

I see the following line:

this.$element[dimension](this.$element[dimension]())[0].offsetHeight

I don't understand what the point .offsetHeight

at the end is unless it has a side effect because it is not assigned with anything. Does it have a side effect?

+3


source to share


2 answers


In some older browsers, such as older versions of IE, sometimes there was a problem of not replanning (re-rendering the presentation) after doing some action.

An investigative request for some properties, such as offsetHeight

causes the DOM to recalculate and redraw objects on the screen.



Thus, the side effect causes the screen to be rescheduled (redrawn). Quirky but old trick for older browsers.

Here is a question where this is suggested as a solution for an old version of Google Chrome where it doesn't work as expected without it.

+4


source


here is a helpful comment from the bootstrap command:



if (doAnimate) this.$backdrop[0].offsetWidth // force reflow

      

+2


source







All Articles