X-Git-Url: http://git.osdn.jp/view?p=pettanr%2FclientJs.git;a=blobdiff_plain;f=0.6.x%2Fjs%2F02_dom%2F05_XNodeAttr.js;fp=0.6.x%2Fjs%2F02_dom%2F05_XNodeAttr.js;h=cdf19c67cee85266dfb8df579090640cdf42ccee;hp=579f286cda7f744b5f621864b888b55ba4249a9c;hb=ef25747bebf1799d49f9bd0d64e339da9ea61d13;hpb=d56e8cc1e13089eb6cbc9dcc6900d7f1828b93df diff --git a/0.6.x/js/02_dom/05_XNodeAttr.js b/0.6.x/js/02_dom/05_XNodeAttr.js index 579f286..cdf19c6 100644 --- a/0.6.x/js/02_dom/05_XNodeAttr.js +++ b/0.6.x/js/02_dom/05_XNodeAttr.js @@ -228,6 +228,10 @@ function X_Node_attr( nameOrObj /* v */ ){ if( this[ '_newAttrs' ] && X_Object_inObject( nameOrObj, this[ '_newAttrs' ] ) ) return this[ '_newAttrs' ][ nameOrObj ]; if( elm = X_UA_DOM.IE4 ? this[ '_rawObject' ] || X_Node__ie4getRawNode( this ) : this[ '_rawObject' ] ){ if( !attrs ) attrs = this[ '_attrs' ] = {}; + + if( this[ '_tag' ] === 'TEXTAREA' && nameOrObj === 'value' && X_UA[ 'IE' ] < 9 ){ + return attrs[ nameOrObj ] = X_Node_Attr_getValueForIE( elm ); + }; return attrs[ nameOrObj ] = elm[ nameOrObj ]; // getAttribute( nameOrObj )? }; }; @@ -236,6 +240,16 @@ function X_Node_attr( nameOrObj /* v */ ){ return attrs && attrs[ X_Node_Attr_renameForTag[ nameOrObj ] || nameOrObj ]; }; }; + + + // ie8- 用に改行文字が \n の場合、 \r\n に変換しておく <- fromawork 内に移動 + // http://qiita.com/hanoopy/items/71456afe32f207369d24 +function X_Node_Attr_getValueForIE( elm ){ + // console.log( elm[ nameOrObj ].length + ' -> ' + elm[ nameOrObj ].split( '\r' ).join( '' ).length ); + // IE は改行文字が /r/n になるがこれを /n に変換 + return elm.value.split( '\r' ).join( '' ); +}; + function X_Node_Attr_setAttr( that, attrs, newAttrs, name, v ){ switch( name ){ case 'ns' :