A
A
Alexey Pavlov2018-06-06 19:46:11
JavaScript
Alexey Pavlov, 2018-06-06 19:46:11

What is the difference between runtimeStyle and currentStyle?

On the MDN site, these are two identical (by description) properties and are only supported in IE6-. However, according to other sources, it will work in IE7/8 as well. In particular, I'm interested in this script, where these two properties are called: sandbox , especially for IE8.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexalexes, 2018-06-06
@AlekseyPavlov

currentStyle is what is described in the CSS selector or in the style attribute, or the elem.style programmatically added (how the developer wants to describe the styles).
runtimeStyle is how the browser was able to draw the given style.
In modern JS, conditionally currentStyle can be considered what we get or write from / to the elem.style.property of the Element, and runtimeStyle is all sorts of offsets and clients - elem.offsetWidth, elem.offsetHeight and so on.
PS: try playing around with currentStyle and runtimeStyle on a table filled with data with varying degrees of cell expansion. Try to change the width of the cells - you will understand the difference where the browser will respond to the given width, and where it will not.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question