OSDN Git Service

925616fc958fadf90db371815cdac47271245d89
[pettanr/clientJs.git] / 0.6.x / js / 02_dom / 00_XDoc.js
1
2
3 X.Doc = {
4         listen : function( type, arg1, arg2, arg3 ){
5                 if( type <= X_ViewPort_readyState && type === 'DOMContentLoaded' ){
6                         /*
7                          * X.Event.XDOM_READY 以後に listen した場合の対策
8                          */
9                         X_ViewPort_document.asyncDispatch( type );
10                 };
11                 type && arg1 && X_ViewPort_document.listen( type, arg1, arg2, arg3 );
12                 return X.Doc;
13         },
14         
15         
16         listenOnce : function( type, arg1, arg2, arg3 ){
17                 if( type <= X_ViewPort_readyState && type === 'DOMContentLoaded' ){
18                         /*
19                          * X.Event.XDOM_READY 以後に listen した場合の対策
20                          */
21                         X_ViewPort_document.asyncDispatch( type );
22                 };
23                 type && arg1 && X_ViewPort_document.listenOnce( type, arg1, arg2, arg3 );
24                 return X.Doc;
25         },
26         
27         unlisten : function( type, arg1, arg2, arg3 ){
28                 type && arg1 && X_ViewPort_document.unlisten( type, arg1, arg2, arg3 );
29                 return X.Doc;
30         },
31         
32         listening : function( type, arg1, arg2, arg3 ){
33                 return X_ViewPort_document.listening( type, arg1, arg2, arg3 );
34         },
35         
36         create     : X_Doc_create,
37         
38         createText : X_Doc_createText
39         
40         // html
41         // head
42         // body
43         // find
44 };
45
46 function X_Doc_create( tag, opt_attrs, opt_css ){
47         var list, i;
48         switch( X_Node_getType( tag ) ){
49                 case X_Node_TYPE.STRING :
50                         X_Node_newByTag = true;
51                         return new Node( tag, opt_attrs, opt_css );
52                 case X_Node_TYPE.HTML_STRING :
53                         list = X_HtmlParser_parse( tag, true );
54                         for( i = list.length; 1 < i; ){
55                                 list[ --i ].destroy();
56                         };
57                         return list[ 0 ];
58         };
59 };
60
61 function X_Doc_createText( text ){
62         X_Node_newByText = true;
63         return new Node( text );
64 };