In a previous post, I had complained about Internet Explorer being broken. It turns out that it actually is possible to set and check the class of a DOM element, but Internet Explorer erroneously uses the moniker className rather than class. So for example, the following works fine in all modern browsers, but has no effect in Internet Explorer:
node.setAttribute('class', 'example');The following example solves the problem for Internet Explorer:
node.setAttribute('className', 'example');
node.setAttribute('class', 'example');I have also found that Internet Explorer evaluates String.split() differently, when given a regular expression as a parameter. Notably the array of values returned does not include any empty string values. For example "a,,c".split(/,/) will confusingly be evaluated as ["a", "c"] rather than ["a", "", "c"].
This caused a problem with highlighting search terms, when the search term was at the beginning of a string, and the unhighlighted prefix would be the empty string. I was able to work around this by using a sentinel value, to prefix the text.