I have a script where I need to assign values for style.left but all borwsers convert integers into exponentials notation if superior to 1e+06 for webkit browser and superior to 1e+07 for others. Any exponential notation are not renderered in a style attribute (like for left, right, translate, etc...).
For example if I assign to a div this style manually:
div.style.left = 1000000+'px';
// or
div.style.left = '1000000px';
Both return in the browser (Google Chrome for example)
<div style="left: 1e+06px;"></div>
And this notation doesn't work to render a style property. It's quite strange that all browsers convert an integer superior to 1 000 000 (or 10 000 000) in exponential notation in a style attribute which doesn't support exponential notation... I tried to use .toPrecision() .toFixed(), etc... but all browsers treat css value after the value is assign.
Is there any way to prevent this behaviour?
Curious why you have to use such a huge numbers, but this works as intended