def[ CONSTRUCTOR ].apply( instance, args ) :\r
def.SuperConstructor &&\r
def.SuperConstructor.apply( instance, args );\r
- if( X.Type.isObject( obj ) && obj !== instance ){\r
+ if( ( X.Type.isObject( obj ) && obj !== instance ) || X.Type.isFunction( obj ) ){ // Class\r
instance.kill();\r
return obj;\r
};\r
\r
_isNew : false,\r
\r
- _rawObject : null,\r
+ _rawObject : null,\r
_rect : null, // \r
\r
_root : null, // xnode が文書ツリーに属しているか?はこれを見る\r
\r
_anime : null,\r
\r
+ /*\r
+ * TODO Node の継承ができない!\r
+ */\r
Constructor : function( v ){\r
var css, xnodes, xnode, parent, uid = Node._chashe.length;\r
\r
// v.parentNode || v.parentElement : dom1 || dom0\r
this.parent = ( parent = v.parentNode || v.parentElement ) && parent.tagName /* ie7- */ && Node._getXNode( parent );\r
this._root = this.parent ? this.parent._root : null;\r
- this._rawObject = v;\r
+ this._rawObject = v;\r
this._xnodeType = 1;\r
this._state = X.Dom.State.DISPLAY_BLOCK; // todo\r
this._tag = v.tagName.toUpperCase();\r
if( xnode = Node._getXNode( v ) ) return xnode;\r
this.parent = Node._getXNode( v.parentNode );\r
this._root = this.parent ? this.parent._root : null;\r
- this._rawObject = v;\r
+ this._rawObject = v;\r
this._xnodeType = 3;\r
this._state = X.Dom.State.DISPLAY_INLINE;\r
this._text = v.data;\r
return Node.none;\r
case Node.IS_IMAGE :\r
if( xnode = Node._getXNode( v ) ) return xnode;\r
- this._rawObject = v;\r
+ this._rawObject = v;\r
this._xnodeType = 4;\r
v.UID = uid;\r
this._state = X.Dom.State.EXIST;\r
case Node.IS_WINDOW :\r
case Node.IS_DOCUMENT :\r
if( xnode = Node._getXNode( v ) ) return xnode;\r
- this._rawObject = v;\r
+ this._rawObject = v;\r
this._xnodeType = 2;\r
this._state = X.Dom.State.DISPLAY_BLOCK;\r
break;\r
X.Net = {\r
\r
xhrGet : function( url ){\r
- return new X_NET_Queue( X_NET_TYPE_XHR, { method : 'GET', get : url } );\r
+ return new X_NET_Queue( X_NET_TYPE_XHR, { method : 'GET', url : url } );\r
},\r
\r
- xhrPost : function( url ){\r
- return new X_NET_Queue( X_NET_TYPE_XHR, { method : 'POST', post : url } );\r
+ xhrPost : function( url, data ){\r
+ return new X_NET_Queue( X_NET_TYPE_XHR, { method : 'POST', url : url, postbody : postbody } );\r
},\r
\r
formGet : function(){\r
},\r
\r
// TODO chashe\r
- jsonp : function( url ){\r
+ // TODO iframe useful or not.\r
+ jsonp : function( url, useIframe ){\r
return new X_NET_Queue( X_NET_TYPE_JSONP, url );\r
},\r
\r
- image : function(){\r
+ image : function( url, useIframe ){\r
\r
+ },\r
+ \r
+ amountQueue : function(){\r
+ return X_NET_QUEUE_LIST.length;\r
}\r
\r
};\r
_isXHR : true,\r
_isXDR : false, // for ie8\r
\r
- _method : null,\r
- _type : null,\r
+ _method : '',\r
+ _type : '',\r
_busy : false,\r
_canceled : false,\r
_lastProgress : 0,\r
\r
load : function( obj ){\r
var raw = X_NET_XHRWrapper._rawObject,\r
- method = obj[ 'get' ] ? 'GET' : 'POST',\r
- url = obj[ 'get' ] || obj[ 'post' ],\r
+ method = obj[ 'method' ],\r
+ url = obj[ 'url' ],\r
async = obj[ 'async' ],\r
user = obj[ 'user' ],\r
password = obj[ 'password' ],\r
headers = obj[ 'headers' ],\r
postbody = obj[ 'postbody' ],\r
- timeout = obj[ 'timeout' ];\r
-\r
+ timeout = obj[ 'timeout' ],\r
+ temp;\r
+ \r
+ if( obj[ 'type' ] ){\r
+ this._type = obj[ 'type' ];\r
+ } else {\r
+ temp = url.split( '#' )[ 0 ].split( '?' )[ 0 ].split( '.' );\r
+ if( 2 <= temp.length ){\r
+ this._type = temp[ temp.length - 1 ].toLowerCase();\r
+ };\r
+ };\r
+ \r
if( X_Net_XHR_X_DOMAIN ){\r
if( false /* isXDomain( url ) */ ){ // isXDomain\r
//if( raw !== X_Net_XHR_X_DOMAIN ){\r
\r
// parse json, html, xml, text, script, css\r
switch( this._type ){\r
- case null :\r
+ case '' :\r
case 'text' :\r
data = raw[ 'responseText' ];\r
break;\r
case 'json' :\r
case 'moz-json' :\r
+ break;\r
case 'document' :\r
+ case 'xml' :\r
+ case 'html' :\r
+ case 'htm' :\r
+ data = raw[ 'responseXML' ];\r
+ break;\r
case 'blob' :\r
case 'arraybuffer' :\r
+ break;\r
};\r
\r
//console.log( 'status ' + status );\r