OSDN Git Service

Version 0.6.221, Update the X.TextRange.
[pettanr/clientJs.git] / 0.6.x / js / 02_dom / 05_XNodeAttr.js
index 579f286..cdf19c6 100644 (file)
@@ -228,6 +228,10 @@ function X_Node_attr( nameOrObj /* v */ ){
                                        if( this[ '_newAttrs' ] && X_Object_inObject( nameOrObj, this[ '_newAttrs' ] ) ) return this[ '_newAttrs' ][ nameOrObj ];\r
                                        if( elm = X_UA_DOM.IE4 ? this[ '_rawObject' ] || X_Node__ie4getRawNode( this ) : this[ '_rawObject' ] ){\r
                                                if( !attrs ) attrs = this[ '_attrs' ] = {};\r
+                                               \r
+                                               if( this[ '_tag' ] === 'TEXTAREA' && nameOrObj === 'value' && X_UA[ 'IE' ] < 9 ){\r
+                                                       return attrs[ nameOrObj ] = X_Node_Attr_getValueForIE( elm );\r
+                                               };\r
                                                return attrs[ nameOrObj ] = elm[ nameOrObj ]; // getAttribute( nameOrObj )?\r
                                        };\r
                                };\r
@@ -236,6 +240,16 @@ function X_Node_attr( nameOrObj /* v */ ){
                return attrs && attrs[ X_Node_Attr_renameForTag[ nameOrObj ] || nameOrObj ];\r
        };\r
 };\r
+\r
+\r
+               // ie8- 用に改行文字が \n の場合、 \r\n に変換しておく <- fromawork 内に移動\r
+               // http://qiita.com/hanoopy/items/71456afe32f207369d24\r
+function X_Node_Attr_getValueForIE( elm ){\r
+       // console.log( elm[ nameOrObj ].length + ' -> ' + elm[ nameOrObj ].split( '\r' ).join( '' ).length );\r
+       // IE は改行文字が /r/n になるがこれを /n に変換\r
+       return elm.value.split( '\r' ).join( '' );\r
+};\r
+\r
 function X_Node_Attr_setAttr( that, attrs, newAttrs, name, v ){\r
        switch( name ){\r
                case 'ns' :\r