August 2009 Blog Posts

Dysfunctional JavaScript

jQuery is, quite rightly, lauded for providing a way of coding JavaScript for web browsers that just works. It pushes you relentlessly towards the pit of success, making simple things easy and difficult things possible. But if there's one niggle I have with coding jQuery, it's the anonymous function noise level. Every block of jQuery code is wrapped up in $(function() { ... }); and inside that you're constantly having to nest yet more anonymous blocks: $(function() { $('div.clickable').click(function() { ... }). }; (Aside: I see a lot of people coding jQuery who don't use the $(function) shorthand to hook up document ready handlers. There's NO NEED...

posted @ Friday, August 14, 2009 10:16 PM | Feedback (5)