.removeClass and .addClass in IE9 with IE7 mode acts weird
I have this snippet, which removes and adds classes. It works for ALL browsers, but if you on IE9 and set IE7 mode, an image (checkimage) starts to blink or disappear on add/remove classes action.. Here is a snippet:
_clearAndSetPrimary: function (row) {
$j('#leademails tr.wasprimary').removeClass('wasprimary');
$j('#leademails tr.isprimary').removeClass('isprimary').addClass('wasprimary');
$j('#leademails tr.wasprimary td.primary').html('<a title="make 开发者_开发问答this the login email" href="#makeprimary">make primary</a>');
row.addClass('isprimary');
$j('#leademails tr.isprimary td.primary').html(checkimage)
}
UPDATE: That was IE9 RC version bug. Installed stable IE9 and the issue fixed itself..
Not sure what to say - another question I read yesterday reported something similar with the way IE acts when you use add/remove/toggleClass. Have you tried plain old .setAttribute()
/.attr()
?
This is definitely true. After doing the remove, I had to check the class name and add extra classes if they had been removed.
Javascript also properly blows up using $('#nodeID').position() - no fail gracefully, no messaging, null or undefined, just function die, so I had to try catch it. Nice to know that if for some really random reason you must support IE7 mode in IE 9 then jQuery will 'freak out'.
精彩评论