OSDN Git Service

fix X.UA & X.Audio, add X.KB.
[pettanr/clientJs.git] / 0.6.x / js / 02_dom / 00_XDoc.js
index c185700..f4c88bb 100644 (file)
@@ -3,47 +3,96 @@
  * @namespace X.Doc
  * @alias X.Doc
  */
-X.Doc = {
-       listen : function( type, arg1, arg2, arg3 ){
+X[ 'Doc' ] = {
+       /**
+        * EventDispatcher.prototype.listen 参照
+        * @alias X.Doc.listen
+        */
+       'listen' : function( type, arg1, arg2, arg3 ){
+               var f;
+               
                if( type <= X_ViewPort_readyState && type === 'DOMContentLoaded' ){
                        /*
                         * X.Event.XDOM_READY 以後に listen した場合の対策
                         */
-                       X_ViewPort_document.asyncDispatch( type );
+                       X_ViewPort_document[ 'asyncDispatch' ]( type );
                };
-               type && arg1 && X_ViewPort_document.listen( type, arg1, arg2, arg3 );
-               return X.Doc;
+               
+               f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 );
+               if( !f.kind ){
+                       X_ViewPort_document[ 'listen' ]( type, this, arg1 );
+               } else
+               if( f.kind === X_CLOSURE_FUNC_ONLY ){
+                       X_ViewPort_document[ 'listen' ]( type, this, f.func, f.supplement );
+               } else {
+                       X_ViewPort_document[ 'listen' ]( type, arg1, arg2, arg3 );
+               };
+               return X[ 'Doc' ];
        },
        
-       
-       listenOnce : function( type, arg1, arg2, arg3 ){
+       /**
+        * EventDispatcher.prototype.listenOnce 参照
+        * @alias X.Doc.listenOnce
+        */
+       'listenOnce' : function( type, arg1, arg2, arg3 ){
+               var f;
+               
                if( type <= X_ViewPort_readyState && type === 'DOMContentLoaded' ){
                        /*
                         * X.Event.XDOM_READY 以後に listen した場合の対策
                         */
-                       X_ViewPort_document.asyncDispatch( type );
+                       X_ViewPort_document[ 'asyncDispatch' ]( type );
+               };
+               
+               f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 );
+               if( !f.kind ){
+                       X_ViewPort_document[ 'listenOnce' ]( type, this, arg1 );
+               } else
+               if( f.kind === X_CLOSURE_FUNC_ONLY ){
+                       X_ViewPort_document[ 'listenOnce' ]( type, this, f.func, f.supplement );
                };
-               type && arg1 && X_ViewPort_document.listenOnce( type, arg1, arg2, arg3 );
-               return X.Doc;
+               X_ViewPort_document[ 'listenOnce' ]( type, arg1, arg2, arg3 );
+               return X[ 'Doc' ];
        },
-       
-       unlisten : function( type, arg1, arg2, arg3 ){
-               type && arg1 && X_ViewPort_document.unlisten( type, arg1, arg2, arg3 );
-               return X.Doc;
+
+       /**
+        * EventDispatcher.prototype.unlisten 参照
+        * @alias X.Doc.unlisten
+        */     
+       'unlisten' : function( type, arg1, arg2, arg3 ){
+               var f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 );
+               
+               if( !f.kind ){
+                       X_ViewPort_document[ 'unlisten' ]( type, this, arg1 );
+               } else
+               if( f.kind === X_CLOSURE_FUNC_ONLY ){
+                       X_ViewPort_document[ 'unlisten' ]( type, this, f.func, f.supplement );
+               } else {
+                       X_ViewPort_document[ 'unlisten' ]( type, arg1, arg2, arg3 );
+               };
+               return X[ 'Doc' ];
        },
-       
-       listening : function( type, arg1, arg2, arg3 ){
-               return X_ViewPort_document.listening( type, arg1, arg2, arg3 );
+
+       /**
+        * EventDispatcher.prototype.listening 参照
+        * @alias X.Doc.listening
+        */     
+       'listening' : function( type, arg1, arg2, arg3 ){
+               var f = X_Closure_classifyCallbackArgs( arg1, arg2, arg3 );
+               
+               if( !f.kind ){
+                       return X_ViewPort_document[ 'listening' ]( type, this, arg1 );
+               } else
+               if( f.kind === X_CLOSURE_FUNC_ONLY ){
+                       return X_ViewPort_document[ 'listening' ]( type, this, f.func, f.supplement );
+               };
+               return X_ViewPort_document[ 'listening' ]( type, arg1, arg2, arg3 );
        },
        
-       create     : X_Doc_create,
+       'create'     : X_Doc_create,
        
-       createText : X_Doc_createText
-       
-       // html
-       // head
-       // body
-       // find
+       'createText' : X_Doc_createText
+
 };
 
 /**
@@ -57,13 +106,13 @@ X.Doc = {
 function X_Doc_create( tag, opt_attrs, opt_css ){
        var list, i;
        switch( X_Node_getType( tag ) ){
-               case X_Node_TYPE.STRING :
+               case X_NodeType_STRING :
                        X_Node_newByTag = true;
                        return new Node( tag, opt_attrs, opt_css );
-               case X_Node_TYPE.HTML_STRING :
+               case X_NodeType_HTML_STRING :
                        list = X_HtmlParser_parse( tag, true );
                        for( i = list.length; 1 < i; ){
-                               list[ --i ].destroy();
+                               list[ --i ][ 'kill' ]();
                        };
                        return list[ 0 ];
        };