Before jQuery.Event.prototype declaration - 2 private functions:
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
are declared... Why not make these public and part of $ just like the $.noop method is? The added code-weight would be approx 2 letters for declaration ( 2 commas added ) and 2 for every call to these 2 functions $. is prepended to each - 2 + 2 * (7 + 4) = 24 letters added.
I propose making a change to jQuery.fn.attr, facilitating copying attributes from another element (passed as argument "name"). value is a list of whitespace-separated words which are attr-keys, these are to be copied from name to this. copyFilter allows passing a function list with attr-keys as keys, letting the programmer make changes to the copied value.
In my opinion, this is common enough to deserve addition to the core.
This change could be done in jQuery.attr instead - but that would cause overhead with computing list.
attr: function( name, value, copyFilter ) { if ( name instanceof jQuery || name.nodeName && (name = $( name )) ) { var list = {}; jQuery.each( value.split( ' ' ), function( val, key ) { list[key] = (val = from.attr( key )) && copyFilter && copyFilter[key] ? (val = copyFilter[key].call( val, key, val )) : val; }); value = list; }