2: The initial error is thrown by line 158 of User:Anthoron/tooltip.js. Specifically, that the HTML Object "document.body" doesn't have the function "getElementsByClassName".
3: Lines 159 and 160 are affected by this, since the variable "divs" doesn't exist (i.e. is "undefined") because of the error thrown in line 158.
4: There is a $D object that exists (see screenshot of IE8's debugger) that has "getElementsByClassName". I didn't bother to look where it came from.
5: To fix the error in line 158 for IE8, you might do something like:
- Code: Select all
// starting from line 158
var divs;
try {
// Existing, working code
var divs = document.getElementsByClassName('tooltip');
} catch (e) {
// When above code invariably fails in IE8, do...
var divs = $D.getElementsByClassName('tooltip');
}
// continuing with current line 159
for (i = 0; i < divs.length; i++) {
new Tooltip(divs[i].id, divs[i].id + '-tooltip');
}
// END OF FILE
6: The variable "Tooltip", which is used as a class object, also uses the newly added $P object (which doesn't exist). This occurs on lines 30 and 31 in the same file.
7: To fix the errors these will undoubtedly throw since $P doesn't exist, you might replace $P each time with the following:
- Code: Select all
// starting from line 30, replacing lines 30 and 31
var this.element;
var this.tool_tip;
try {
this.element = $P(element);
} catch (e) {
this.element = document.getElementById(element);
}
try {
this.tool_tip = $P(tool_tip);
} catch (e) {
this.tool_tip = document.getElementById(tool_tip);
}
// ...
8: Another thought, I remember there being some separate loading javascript code that first loaded the prototype.js library and then the tooltip.js file. Have you looked at it to see if the changes Wikia made to prototype.js would affect it? I mean, it clearly works in Firefox, prototype.js and all, so I'd think it would be worth looking at just to check and see if some prototype.js function was used within the loading portion that maybe needs to be updated after the changes. I forget where that code was placed, though.
9: In reference to #2, the actual code responsible for the error is in prototype.js, line 4857, and it can probably be fixed by the following:
- Code: Select all
// starting at line 4857, replacing the line
try {
return $P(parentElement || document.body).getElementsByClassName(className);
} catch (e) {
// "document" has the function "getElementsByClassName", according to the IE8 debugger
return $P(parentElement || document).getElementsByClassName(className);
}
10: The code I'm providing you with was tested within IE8's developer tool's debugger that comes integrated with IE8. If it doesn't work in actual implementation, I'm sorry.
Screenshot:
IE Debug: Proof of $D ("getElementsByClassName" is the 19th function under $D)







