Note to self, PPK does this better than I do. Did. It’s !Spiffy! Thanks PPK!
JavaScript Triggers: A List Apart
Once upon a time I created an app for work that utilized Internet Explorer’s pathetic “Behavior” system. I’ve wanted to rewrite it ever since it became obvious with real data, that its performance was awful.
The flaws are that the behavior file is downloaded (or reparsed or something) from memory for every element it applies to. The result is a thousand little hour-glass flashes as the page loads – not to mention even slower load time than usual.
What makes PPK’s solution great is that:
- It doesn’t use the behavior crap I tried with IE,
- That makes it cross-browser compatible and I can finally push to get rid of that stupid browser at work,
- Modifying the DTD would work wonderfully on our site, making the code clean, the css clean, and the javascript self-contained and clean, and
- It continues the notion of custom attributes I’ve been using in tags for quite a while with JS, but shows me how to do it with the DOM so it’s cross browser happy (and tested) instead of my “hrmm, works in this browser” justification.
Personally, I don’t care that W3C Validation fails on it. It’s a tool, not a requirement.