> 1. The script only looks for declarations in the stylesheets, that's the > beauty of it.
yes, but I mean that if you look at the content of the cssRules variable you will see that there are a lot of css declaration which could be avoided (or they can't ?) > 3. Yeah i know but I'm lazy. Here's an optimized version if you want (hope tabs will be kept). I also added a condition in order to check cssRules[i][1] in the last loop because on the page I tested, the value is empty for two items and it causes an error in IE when addRule() is called with empty second argument (I didn't checked why). // ie6HoverFix - Author : Christian Bach $.ie6HoverFix = function() { if ($.browser.msie && $.browser.version < 7) { var cssRules = [], newStyleSheet = document.createStyleSheet(), styleSheets = document.styleSheets; function parseCSS(rule) { var prefix = "ie6fix-"; var select = rule.selectorText, style = rule.style.cssText; var element = select.replace(/:(hover).*$/, ''); var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, '$1'); var styleRule = element + "." + prefix + pseudo; var className = prefix + pseudo; $(element).hover(function(e) { $(this).addClass(className); }, function(e) { $(this).removeClass(className) }); cssRules.push([styleRule,style]); } for (var i = 0, ii = styleSheets.length; i < ii; i++) { for(var j = 0, jj = styleSheets[i].rules.length; j < jj; j++) { parseCSS(styleSheets[i].rules[j]); } } for (var i = 0, ii = cssRules.length; i < ii; i++) { var ruledef = cssRules[i][1]; if (ruledef.length != 0) { newStyleSheet.addRule(cssRules[i][0], ruledef); } } } }; -- Fabien Meghazi Website: http://www.amigrave.com Email: [EMAIL PROTECTED] IM: [EMAIL PROTECTED]