var uid = X_Node_CHASHE.length,
css, xnodes, xnode, parent;
- if( X_Node_newByTag ){
+ // TODO 継承クラスで this.Super('DIV') ができない! -> サブクラスから呼ばれた場合も
+ if( X_Node_newByTag || this.constructor !== Node ){
X_Node_newByTag = false;
this[ '_tag' ] = v.toUpperCase();
arguments[ 1 ] && this[ 'attr' ]( arguments[ 1 ] );
X_Node_CHASHE[ this[ '_uid' ] = uid ] = this;
},
+ // TODO .mesure() -> X.Event.MESURED
'width' : X_Node_width,
'height' : X_Node_height,
'clientWidth' : X_Node_clientWidth,
'createTextAt' : X_Node_createTextAt,
+ 'createRange' : X_Node_createRange,
+
'clone' : X_Node_clone,
'append' : X_Node_append,
'toggleClass' : X_Node_toggleClass,
'hasClass' : X_Node_hasClass,
- 'html' : X_Node_html,
+ 'html' : X_Node__html,
'text' : X_Node_text,
'call' : X_Node_call,
'each' : X_Node_each
if( X_Type_isString( v ) ){
return '<' === v.charAt( 0 ) && v.charAt( v.length - 1 ) === '>' ? X_NodeType_HTML_STRING : X_NodeType_STRING;
};
+ // Node サブクラスのインスタンス
if( v[ 'instanceOf' ] && v[ 'instanceOf' ]( Node ) ) return X_NodeType_XNODE;
return 0;
};
};
/**
+ * 選択されたテキストへの参照やテキスト座標情報
+ * @alias Node.prototype.createRange
+ * @return {TextRange} 新規作成されたテキストレンジ
+ */
+function X_Node_createRange( a, b, c ){
+ return X_TextRange( this, a, b, c );
+};
+
+/**
* Node のクローンを作成し返す。id もクローンされる点に注意。イベントリスナはクローンされない。
* http://d.hatena.ne.jp/think49/20110724/1311472811
* http://d.hatena.ne.jp/uupaa/20100508/1273299874
* @return {string|Node}
* @example node.html( '<img>' );
*/
-function X_Node_html( html ){
+function X_Node__html( html ){
var _ = '', q = '"', xnodes, n, i, l;
// setter
if( html !== undefined ){ // String 以外に Number や false null なども許可
var X_Node_updateReservedByReleaseGPU = false;
function X_Node_startUpdate( time ){
- var removal, i, xnodeOrElm, xnodesIEFilterFixAfter, xnode;
+ var removal, i, xnodeOrElm, xnodesIEFilterFixAfter, xnode, active;
if( !X_Node_updateTimerID || X_ViewPort_readyState < X_EVENT_INIT ){
return;
removal.length = 0;
};
-
- X_UA[ 'IE5' ] && ( X_elmBody.style.visibility = 'hidden' );
-
+ // 強制的に再描画を起こす, 但し activeElement からフォーカスが外れるため復帰する
+ // IE5mode win10 で 確認
+ if( X_UA[ 'IE5' ] ){
+ active = document.activeElement;
+ X_elmBody.style.visibility = 'hidden';
+ };
+
if( X_Node_html[ '_flags' ] & X_Node_BitMask_IS_DIRTY ){
X_Node__commitUpdate( X_Node_html, X_Node_html[ '_rawObject' ].parentNode, null, X_Node_html[ '_flags' ], 1, xnodesIEFilterFixAfter = [] );
} else {
X_Node__commitUpdate( X_Node_head, X_Node_head[ '_rawObject' ].parentNode, null, X_Node_head[ '_flags' ], 1, xnodesIEFilterFixAfter = [] );
X_Node__commitUpdate( X_Node_body, X_Node_body[ '_rawObject' ].parentNode, null, X_Node_body[ '_flags' ], 1, xnodesIEFilterFixAfter = [] );
};
-
- X_UA[ 'IE5' ] && ( X_elmBody.style.visibility = '' );
+
+ if( X_UA[ 'IE5' ] ){
+ X_elmBody.style.visibility = '';
+ active && active.parentNode && active.focus();
+ };
if( X_Node_updateReservedByReleaseGPU ){
X_Node_reserveUpdate();
if( !elm ){
if( !that[ '_tag' ] ){
that[ '_flags' ] &= X_Node_BitMask_RESET_DIRTY;
- elm = document.createTextNode( X_String_chrReferanceTo( that[ '_text' ] ) );
+ if( X_UA[ 'IE' ] < 8 ){
+ // \n -> \r\n に変換しないと pre タグで開業されない win10ie7(ie11 emu) で確認
+ elm = document.createTextNode( X_String_chrReferanceTo( that[ '_text' ] ).split( '\n' ).join( X_String_CRLF ) );
+ } else {
+ elm = document.createTextNode( X_String_chrReferanceTo( that[ '_text' ] ) );
+ };
if( !X_UA[ 'IE' ] ){
elm[ 'UID' ] = that[ '_uid' ];
};
// textNode
if( !that[ '_tag' ] ){
- elm.data = X_String_chrReferanceTo( that[ '_text' ] );
+ if( X_UA[ 'IE' ] < 8 ){
+ // \n -> \r\n に変換しないと pre タグで開業されない win10ie7(ie11 emu) で確認
+ elm.data = X_String_chrReferanceTo( that[ '_text' ] ).split( '\n' ).join( X_String_CRLF );
+ } else {
+ elm.data = X_String_chrReferanceTo( that[ '_text' ] );
+ };
that[ '_flags' ] &= X_Node_BitMask_RESET_DIRTY;
return;
};
elm.setAttribute( 'class', that[ '_className' ] ) :
( elm.className = that[ '_className' ] )
) :
- ( elm.className && elm.removeAttribute( X_UA[ 'IE' ] < 8 ? 'className' : 'class' ) ); // className は ie7-
+ ( elm.className && elm.removeAttribute( X_UA[ 'IE' ] < 8 ? 'className' : 'class' ) ); // className は ie7-
};
// attr