//*** This code is copyright 2003-2004 by Gavin Kistner, !@phrogz.net //*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt //*** Reuse or modification is free provided you abide by the terms of that license. //*** (Including the first two lines above in your source code mostly satisfies the conditions.) // Find the CSS rule by its selector text. // e.g. FindRule(document.styleSheets[0],'a.selected').style.fontWeight='bold'; function FindRule(ss,selText){ if (!ss) return; if (ss.cssRulesCache==null) ss.cssRulesCache={}; var cache=ss.cssRulesCache; //screw case sensitivity; IE and Mozilla don't agree on case for elements themselves selText=selText.toLowerCase(); if (cache[selText]) return cache[selText]; var rules = ss.cssRules || ss.rules; for (var i=0,len=rules.length;i