kennethreitz.org / Essays / 2009 / Dry And Pythonic Jquery
DRY and Pythonic jQuery?
Apparently, groovy:spring:java as jabs:jquery:javascript. As if jQuery wasn't short enough already.
Jabs lets you write this jQuery code:
jQuery(function() {var $ = jQuery;
$("[default_value]").blur(function() {var self = $(this);if(self.val() === "") {self.val(self.attr("default_value"));}}).focus(function() {var self = $(this);if(self.val === self.attr("default_value")) {self.val("");}}).blur();});
By typing this:
$ [default_value]:blurif @value === ""@value = @default_value:focusif @value === @default_value@value = "".blur
HAML tactics FTW.