Arg!
After getting a cryptic “Object required” error from all IE’s (6,7,8), I tracked it down. It seemed to be coming from my library, line 134 in bold
Basis.hasClass = function(target, classValue) {
var pattern = new RegExp('(^| )' + classValue + '( |$)');
[b] if (pattern.test(target.className)) {[/b]
return true;
}
return false;
};
So IE8 has some sort of script debugger so I stepped through it… what it really didn’t like was when this function was called by something it thought had a null value (so, target above ended up being null):
in my regular script:
[b]//"input" here is always the form control with the id "TypeKiezen"[/b]
chooseType: function(input) {
var val = input.value.toLowerCase(),
value;
for (result in Begrafenis.kosten[input.id][val].show) {
[b]value = document.getElementById(Begrafenis.kosten[input.id][val].show[result]);[/b]
Basis.removeClass(value, 'none');
}
for (result in Begrafenis.kosten[input.id][val].hide) {
[b]value = document.getElementById(Begrafenis.kosten[input.id][val].hide[result]);
[/b] Basis.addClass(value, 'none');
}
Begrafenis.setSelectedValue(value);
},
value isn’t getting assigned in IE, so it’s null. It is getting assigned in all other browsers, so that leaves out an obvious error.
I haven’t found where IE lists all the relevant things (I’m only seeing “value” here), so I’m not sure where in my map/hash object IE is failing or why.
Here’s the object called “kosten” that everyone but IE can read:
(inside the main object “Begrafenis”)
kosten: {
'BasisKosten': {
'value': {
'2000': 2000
}
},
[b] 'TypeKiezen': {
'value': {
'begraven': 'zie onder',
'cremeren': 1500
},
'begraven': {
'show': ['Postal', 'Box']
},
'cremeren': {
'hide': ['Postal', 'Box']
}
},[/b]
'Kist': {
'value': {
'geen': 0,
'eenvoudig': 400,
'standaard': 750,
'luxe': 1000
}
},
'Herdenkingsdienst': {
'value': {
'geen': 0,
'rouwcentrum': 250,
'kerk': 500
}
},
'Volgautos' : {
'value': {
'geen': 0,
'een': 200,
'twee': 400,
'drie': 600
}
},
'Koffietafel' : {
'value': {
'geen': 0,
'50': 250,
'100': 500,
'150': 750
}
},
'Rouwbrieven' : {
'value': {
'geen': 0,
'50': 150,
'100': 200,
'150': 450
}
},
'DankBid' : {
'value': {
'geen': 0,
'100': 175,
'200': 250,
'300': 325
}
},
'Advertenties' : {
'value': {
'geen': 0,
'regionaal': 650,
'landelijk': 1000,
'beide': 1650
}
},
'Bloemen' : {
'value': {
'geen': 0,
'eenvoudig': 100,
'standaard': 150,
'luxe': 200
}
},
'Grafsteen' : {
'value': {
'geen': 0,
'staande': 1500,
'liggende': 2000,
'grafmonument': 2500
}
}
},
The Typekiezen is a weird one; if there’s a nicer/better way of writing that, that would be nice, but it happens this form input does several things when it’s clicked… the others only bring up an associated value for the option chosen so they’re simpler.
Does anyone know why IE can’t read this " document.getElementById(Begrafenis.kosten[input.id][val].hide[result])"
…or another way I could write it so that IE does get it. Basically, the code needs to grab the ID’s “Postal” and “Box” so the show/hide scripts can DoStuff to them.
Even if I do a bit of
if (value !== null) {
Basis.add/removeClass(value, ‘none’);
}
this still isn’t going get IE to do the right thing, just remove the error.