X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=0.6.x%2Fjs%2F02_dom%2F05_XNodeAttr.js;h=cdf19c67cee85266dfb8df579090640cdf42ccee;hb=ef25747bebf1799d49f9bd0d64e339da9ea61d13;hp=a438590c3cd5212939cd9af635a3b1ad7cc50046;hpb=733b1bb359e89b077ad347a5737b4cd610f0a8cb;p=pettanr%2FclientJs.git diff --git a/0.6.x/js/02_dom/05_XNodeAttr.js b/0.6.x/js/02_dom/05_XNodeAttr.js index a438590..cdf19c6 100644 --- a/0.6.x/js/02_dom/05_XNodeAttr.js +++ b/0.6.x/js/02_dom/05_XNodeAttr.js @@ -190,7 +190,7 @@ function X_Node_attr( nameOrObj /* v */ ){ }; return this; } else - if( typeof nameOrObj === 'string' ){ + if( X_Type_isString( nameOrObj ) ){ // getter switch( nameOrObj ){ case 'id' : @@ -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,15 +240,25 @@ 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' : case 'NS' : if( v === 'svg' || v === 'SVG' ){ - that[ '_flags' ] |= XX_NodeFlags_IS_SVG; + that[ '_flags' ] |= X_NodeFlags_IS_SVG; }; if( v === 'vml' || v === 'VML' ){ - that[ '_flags' ] |= XX_NodeFlags_IS_VML; + that[ '_flags' ] |= X_NodeFlags_IS_VML; }; return;