It's time to talk about Internet Explorer 8 again. This time, it's about how we failed to recognize an issue with a library aimed at enabling CSS3 psuedo-selectors called Selectivizr.
Selectivizr appeared to be quite the cure-all when I first came across it. In their own words, this is what it does:
selectivizr was written to make using CSS3 selectors in Internet Explorer completely seamless...
but to their credit is followed by:
Unfortunately, we stumbled upon an issue not outlined on their site:
A script on this page is causing your web browser to run slowly. If it continues to run, your computer might become unresponsive.
You could elect to let it run or stop the script. In retrospect, this would have been an easy problem to avoid if it had popped up when we added the library, because we would have just removed it and moved on.
Where the confusion stemmed from though, was by adding the library almost a year ago and letting it exist until now. It slipped from the forefront of our minds and we assumed it was running along happily. Then, out of no where, this mysterious error.
Like any normal programmer, we start to try and debug by undoing what we did. It fixes it. Excellent. Let's just implement this another way, perhaps with more efficient JS seeing as the error is triggered by:
JS is single-threaded and IE8 throws this error when 5,000,000 statements are run in a row
Wait... 5,000,000 statements? I was hiding and showing a few elements with JQuery or something equally trivial. I begin to look at our other JS on that page seeing as it wasn't happening anywhere else - it must be the JS on this page that's causing it.
As it turns out, Selectivizr was the problem, but not in the way we'd expected. It dawned on me that Selectivizr must run through every single element on the page to do what it does. That was furthered supported by deleting some random HTML elements and eventually it no longer caused the error to trigger. We're working towards removing Selectivizr all together and I would encourage people to think before using it themselves.