root / trunk / web / dojo / dojox / dtl / Context.js @ 12
History | View | Annotate | Download (1.22 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
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.dtl.Context"]){ |
||
9 | dojo._hasResource["dojox.dtl.Context"]=true; |
||
10 | dojo.provide("dojox.dtl.Context");
|
||
11 | dojo.require("dojox.dtl._base");
|
||
12 | dojox.dtl.Context=dojo.extend(function(_1){
|
||
13 | this._this={};
|
||
14 | dojox.dtl._Context.call(this,_1);
|
||
15 | },dojox.dtl._Context.prototype,{getKeys:function(){ |
||
16 | var _2=[];
|
||
17 | for(var _3 in this){ |
||
18 | if(this.hasOwnProperty(_3)&&_3!="_this"){ |
||
19 | _2.push(_3); |
||
20 | } |
||
21 | } |
||
22 | return _2;
|
||
23 | },extend:function(_4){ |
||
24 | return dojo.delegate(this,_4); |
||
25 | },filter:function(_5){ |
||
26 | var _6=new dojox.dtl.Context(); |
||
27 | var _7=[];
|
||
28 | var i,_8;
|
||
29 | if(_5 instanceof dojox.dtl.Context){ |
||
30 | _7=_5.getKeys(); |
||
31 | }else{
|
||
32 | if(typeof _5=="object"){ |
||
33 | for(var _9 in _5){ |
||
34 | _7.push(_9); |
||
35 | } |
||
36 | }else{
|
||
37 | for(i=0;_8=arguments[i];i++){ |
||
38 | if(typeof _8=="string"){ |
||
39 | _7.push(_8); |
||
40 | } |
||
41 | } |
||
42 | } |
||
43 | } |
||
44 | for(i=0,_9;_9=_7[i];i++){ |
||
45 | _6[_9]=this[_9];
|
||
46 | } |
||
47 | return _6;
|
||
48 | },setThis:function(_a){ |
||
49 | this._this=_a;
|
||
50 | },getThis:function(){ |
||
51 | return this._this; |
||
52 | },hasKey:function(_b){ |
||
53 | if(this._getter){ |
||
54 | var _c=this._getter(_b); |
||
55 | if(typeof _c!="undefined"){ |
||
56 | return true; |
||
57 | } |
||
58 | } |
||
59 | if(typeof this[_b]!="undefined"){ |
||
60 | return true; |
||
61 | } |
||
62 | return false; |
||
63 | }}); |
||
64 | } |