JSでthisをそのまま返す関数を作っておくと便利?

DOM操作では以下のように setAttribute してすぐメソッドを呼べない

elm.setAttribute( "name", "value" ).getAttribute( "name" );

なので、引数の関数を実行してthisを返す関数を作ってやると

Object.prototype.expr = function( method ){var args = Array.prototype.slice.call( arguments, 1 );this[ method ].apply( this, args );return this;};
elm.expr( "setAttribute", "name", "value" ).getAttribute( "name" );

微妙だなー。やっぱ jQuery 使うわ。

(参考文献: http://d.hatena.ne.jp/amachang/20090803/1249292858)