Scriptaculous + JS optimizations can cause problems


With everyone raving about YSlow I used it to prune a new project I was doing. Well, after the results worked just great with Safari and Firefox I was thoroughly confused why it wasn't working correctly in IE. The problem was that my routines weren't working, and more specifically I was getting really weird errors when the page was loading, before any of the routines executed. Some of the errors were very vague, e.g. "'Class' is undefined", and "Effect.toggle is undefined". Well after lots of kicking around I finally tried something - I removed the defer="defer" attributes off the JS calls and it magically started working! Go figure! So, at the end of the day the lesson is that if you are using you can't use defer="defer" on your Prototype.js call, otherwise visitors using IE will be greated with a whole bunch of error messages and nothing will work.