How to combine these:
‘addRule()’ for MSIE and ‘insertRule()’ for standards-compliant browsers: so far, when I test on Firefox or IE8, one of the browsers always chokes on the version of the script which doesn’t apply to it.
I’ve also tried using conditional comments to separate out the msie version, but that doesn’t seem to work either, as the scripts still have to be called, and thatr’s where the choke happens.
Here’s the full (clunky) versions; they add a red fullstop:
var elA = document.getElementsByTagName(“*”);
var S = document.styleSheets[0];
//msie:
function IEaddDot1a() {
for (i=0; i<elA.length; i++) {
if (elA.item(i).className.charAt(0) == “A”) {
S.addRule(‘.A1:after’, ‘position:relative; top:0.45em; margin:0 0 0 -0.4em; font-size:80%; color:#f11; content: ” .”‘) }
}
}
//standards:
function addDot1a() {
for (i=0; i<elA.length; i++) {
if (elA.item(i).className.charAt(0) == “A”) {
S.insertRule(‘.A1:after {position:relative; top:0.45em; margin:0 0 0 -0.4em; font-size:80%; color:#f11; content:” .”}’,S.cssRules.length) }
}
}