I have a bit of a puzzling issue. I am trying to set the CSS top using jQuery 3.5.1 in Firefox and I was expecting to be able to retrieve it again as the same value. Try this on any div
element:
$('#test-div').css('top', 1.11111);
alert(parseFloat($('#test-div').css('top')));
The alert is:
1.11667
It is not the same as 1.11111
due to the way different browsers handle fractional pixels. It seems to work alright in other browsers I've tested it with (Edge and Chrome, for example, which seem to have a six digit granularity).
When I inspect the HTML, the value is set correctly from the jQuery side to 1.11111
. Is there any way to fetch this value exactly as it is set in the DOM such that I get back 1.11111
?