Project

General

Profile

Statistics
| Revision:

root / trunk / web / dojo / dojox / mobile / parser.js @ 10

History | View | Annotate | Download (1.48 KB)

1
/*
2
        Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3
        Available via Academic Free License >= 2.1 OR the modified BSD license.
4
        see: http://dojotoolkit.org/license for details
5
*/
6

    
7

    
8
if(!dojo._hasResource["dojox.mobile.parser"]){
9
dojo._hasResource["dojox.mobile.parser"]=true;
10
dojo.provide("dojox.mobile.parser");
11
dojo.provide("dojo.parser");
12
dojox.mobile.parser=new function(){
13
this.instantiate=function(_1,_2){
14
var ws=[];
15
if(_1){
16
var i,_3;
17
_3=_1.length;
18
for(i=0;i<_3;i++){
19
var _4=_1[i];
20
var _5=dojo.getObject(dojo.attr(_4,"dojoType"));
21
var _6=_5.prototype;
22
var _7={};
23
if(_2){
24
for(var _8 in _2){
25
_7[_8]=_2[_8];
26
}
27
}
28
for(var _9 in _6){
29
var _a=dojo.attr(_4,_9);
30
if(!_a){
31
continue;
32
}
33
if(typeof _6[_9]=="string"){
34
_7[_9]=_a;
35
}else{
36
if(typeof _6[_9]=="number"){
37
_7[_9]=_a-0;
38
}else{
39
if(typeof _6[_9]=="boolean"){
40
_7[_9]=(_a!="false");
41
}else{
42
if(typeof _6[_9]=="object"){
43
_7[_9]=eval("("+_a+")");
44
}
45
}
46
}
47
}
48
}
49
_7["class"]=_4.className;
50
_7["style"]=_4.style&&_4.style.cssText;
51
ws.push(new _5(_7,_4));
52
}
53
_3=ws.length;
54
for(i=0;i<_3;i++){
55
var w=ws[i];
56
w.startup&&!w._started&&(!w.getParent||!w.getParent())&&w.startup();
57
}
58
}
59
return ws;
60
};
61
this.parse=function(_b,_c){
62
if(!_b){
63
_b=dojo.body();
64
}else{
65
if(!_c&&_b.rootNode){
66
_b=_b.rootNode;
67
}
68
}
69
var _d=_b.getElementsByTagName("*");
70
var _e=[];
71
for(var i=0,_f=_d.length;i<_f;i++){
72
if(_d[i].getAttribute("dojoType")){
73
_e.push(_d[i]);
74
}
75
}
76
return this.instantiate(_e,_c);
77
};
78
};
79
dojo._loaders.unshift(function(){
80
if(dojo.config.parseOnLoad){
81
dojox.mobile.parser.parse();
82
}
83
});
84
}