Firefox rendering prevention between javascript statements

I am trying to create some kind of scale around the mouse cursor function on my website that ultimately runs these two lines (+ the same for height / scrollTop).

canvas.style.width = someValue;
canvas.parentNode.scrollLeft = someOtherValue;

The problem is that in firefox (3.6) the page is re-displayed immediately after the first line has been executed, and since the presentation depends on both values, this means that every time I recalculate the view, Firefox will display invalid before the correct one In other words, creating a flicker.

I tried replacing two lines, but getting the same problem.

In chrome, opera and IE this does not happen. Both lines are executed before any rendering.

Is there a way to block rendering manually, maybe something like this?

document.disableRendering();        //fantasy function
canvas.style.width = someValue;
canvas.parentNode.scrollLeft = someOtherValue;
document.enableRendering();         //fantasy function
+3
1

.display = 'none'; DOM.

+1

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


All Articles