テーブルのTDの要素をINPUT要素に切り替えるためのオブジェクト

多分、表のデータをか着替えたいときなどに有効かも?

var Input2TD = (function ( delChild ) {
  return function ( ) {
    var e = document.createElement( 'input' );
        e.setAttribute( 'type', 'text' );
        e.value = '';

    this.input = e;
    this.mode = false;
    this.element = null;

    this.check = function( e ) {
      return this.mode && this.input != e;
    };

    this.edit = function ( e, val, css ) {
      if(! this.mode ) {
        var inp = this.input;
            inp.style.width = e.offsetWidth + 'px';
            inp.value = 'undefined' != typeof val ?
              val: e./*@if( @_jscript ) innerText @else@*/ textContent /*@end@*/;

        this.element = e;
        this.value = inp.value;
        this.mode = true;

        if( 'undefined' != typeof css ) inp.className = css;
        delChild( e );
        e.appendChild( inp );
        inp.focus();
      }
    };

    this.Indication = function ( val ) {
      if( this.mode ) {
        var e = this.element;
        var v = 'undefined' !== typeof val ? val: this.input.value;
        delChild( e );
        e.appendChild( document.createTextNode( v ) );
        this.mode = false;
      }
    };
  };
})(
    function (e) { while( e.hasChildNodes() ) e.removeChild( e.lastChild ) }
  )