IE8 is subtracting wrong in JavaScript / jQuery?
Posted
by Oscar Godson
on Stack Overflow
See other posts from Stack Overflow
or by Oscar Godson
Published on 2010-04-09T23:10:36Z
Indexed on
2010/04/09
23:13 UTC
Read the original article
Hit count: 345
In every browser, Win/Mac, Chrome, Safari, Firefox, Opera, IE6, and IE7 they ALL get the following console output:
352
254
But in IE8 I get:
414
434
454
474
Here is my JS/jQuery code:
$('#top-breadcrumbs').children('a').each(function(i){
if(!$(this).hasClass('permanent')){
if(permItemWidth+rmItemWidth > $('#top-breadcrumbs').width()){
$(this).addClass('removed');
rmItemWidth = rmItemWidth-$(this).width()+20;
}
}
});
The log code i have above is writing the NEW rmItemWidth
value after its been reset in that 2nd if
© Stack Overflow or respective owner