Why I switched back to Prototype from YUI

While I love YUI's documentation, I just can't help but prefer this:

function checkExistingNamesRequest(name, value){ var div = 'checkExistingNames_'+name+'_container'; loading(div, "existing "+name+" names"); var myAjax = new Ajax.Updater( div, "./checkExistingNames.cgi", { parameters: $H({ name:name, value:value }).toQueryString() } ); }

To this:

var svrCheckExistingNames = "checkExistingNames.cgi"; var checkExistingNamesSuccess = function(o, n) { if(o.responseText !== undefined) { $('checkExistingNames_'+n+'_container').innerHTML = o.responseText; } } nameHandler = function(o) { checkExistingNamesSuccess(o, this.name); } var clientTest = nameHandler.bind({name: 'client'}); var projectTest = nameHandler.bind({name: 'project'}); var collectionTest = nameHandler.bind({name: 'collection'}); var collrefTest = nameHandler.bind({name: 'collref'}); function checkExistingNamesRequest(n, v){ $('checkExistingNames_'+n+'_container').innerHTML = "Checking existing "+n+" names... <img src='../icons/loading.gif' border=1>"; var test = clientTest; if (n == 'project') test = projectTest; if (n == 'collection') test = collectionTest; if (n == 'collref') test = collrefTest; var request = YAHOO.util.Connect.asyncRequest('GET', svrCheckExistingNames+"?name="+n+"&value="+v, {success: test, failure: test}); }


Which do you think is more maintainable?

(Frickin' Blogger is not meant for code, is it?!?)

No comments: