mutateElementToAffectOffsetTop(someElement);
// (1) We don't know the value of someElement.offsetTop here because we compute it lazily.
var y = (new DOMTransaction(function () {
// (2) We need to remember the "old value" of someElement.offsetTop here.
mutateElementToAffectOffsetTop(someElement);
return someElement.offsetTop;
})).execute();
If DOMTransaction
were to preserve the old value, then y
needs to be identically equal to the value of someElement.offsetTop
at (1). However, since nobody had asked for the value in (1), we're forced to pre-compute the value at (2). It's worse than that. mutateElementToAffectOffsetTop
might be using the old value of other computed CSS values in which case we have to pre-compute all the property values that could be queried by the script at (2).