Possible future bug
Hi, I saw you are also using a trick I've been toying with myself recently: your mouseover and mouseout functions.
The idea is very simple yet powerful. But you seem to have made the same mistake I initially had, concerning one little detail.
Suppose you have <div class="button blabla blabla2"> . What if you then use mouseout(this, 'blabla')? (I know it's a bit far-fetched, but it can happen... and when it does it's gonna be hard to find the bug!)
The way I fixed this was adding an extra space _behind_ the classname in the mouseover function. But looking at your code (using RegExp) it might be possible to add an "end-of-word" match to your regexp? (I'm not very familiar with JavaScript regexps.)
Also, I think I remember a cross-browser problem with "my" solution: some browsers seem to remove the extra space. _Maybe_ your solution also suffers from this when the space in mouseover() is automatically removed by the browser (in case an object has only one class).
var mouseout = function(element, name){
try {
element.className = element.className.replace(RegExp(" " + name, "g"), "");
}
catch(error){
// ignore errors
}
};
Hope this helps and prevents some inexplicable bug in the future. (sorry if any of the above is wrong).
The idea is very simple yet powerful. But you seem to have made the same mistake I initially had, concerning one little detail.
Suppose you have <div class="button blabla blabla2"> . What if you then use mouseout(this, 'blabla')? (I know it's a bit far-fetched, but it can happen... and when it does it's gonna be hard to find the bug!)
The way I fixed this was adding an extra space _behind_ the classname in the mouseover function. But looking at your code (using RegExp) it might be possible to add an "end-of-word" match to your regexp? (I'm not very familiar with JavaScript regexps.)
Also, I think I remember a cross-browser problem with "my" solution: some browsers seem to remove the extra space. _Maybe_ your solution also suffers from this when the space in mouseover() is automatically removed by the browser (in case an object has only one class).
var mouseout = function(element, name){
try {
element.className = element.className.replace(RegExp(" " + name, "g"), "");
}
catch(error){
// ignore errors
}
};
Hope this helps and prevents some inexplicable bug in the future. (sorry if any of the above is wrong).
sufcrusher
July 17,