One last thing. Take a look at the very bottom of behaviour.js, they've actually documented a regular expression using ASCII. Regex is a twistedly powerful tool, but it's such a bitch to reverse engineer, documenting it like this could prove to be a very useful technique.
Saturday, July 23, 2005
Behaviour : Using CSS selectors to apply Javascript behaviours
jfred showed me script.aculo.us, and I was like, that's cool, I'm sure the drag and drop stuff will come in handy at some point, but I'm not sure if I like the animation, it feels too much like the stupid transition effects in windows that are too slow so I turn them off immediately after installing. Now Jon just pointed out one of the libraries used by script.aculo.us, which jfred may have as well, but my attention was obviously elsewhere at the time because this is really cool shit. The DOM can be a pain to traverse just to add your events. It's not actually that hard, but adding events directly is just so easy, when up against a deadline ideals have a way of slipping. But CSS selectors, if not the easiest thing to learn (do you remember the first time you had to wrap your head around precedence?) are used on a more day to day basis (at least at my gig) so they are totally painless. I'd rather use CSS than the DOM to apply events any day.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment