1 if(!dojo._hasResource["dojox.dtl.Context"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
2 dojo._hasResource["dojox.dtl.Context"] = true;
3 dojo.provide("dojox.dtl.Context");
4 dojo.require("dojox.dtl._base");
6 dojox.dtl.Context = dojo.extend(function(dict){
8 dojox.dtl._Context.call(this, dict);
9 }, dojox.dtl._Context.prototype,
11 extend: function(/*dojox.dtl.Context|Object*/ obj){
12 // summary: Returns a clone of this context object, with the items from the
13 // passed objecct mixed in.
14 var context = new dojox.dtl.Context();
15 var keys = this.getKeys();
17 for(i = 0; key = keys[i]; i++){
18 if(typeof obj[key] != "undefined"){
19 context[key] = obj[key];
21 context[key] = this[key];
25 if(obj instanceof dojox.dtl.Context){
27 }else if(typeof obj == "object"){
34 for(i = 0; key = keys[i]; i++){
35 context[key] = obj[key];
40 filter: function(/*dojox.dtl.Context|Object|String...*/ filter){
41 // summary: Returns a clone of this context, only containing the items
42 // defined in the filter.
43 var context = new dojox.dtl.Context();
46 if(filter instanceof dojox.dtl.Context){
47 keys = filter.getKeys();
48 }else if(typeof filter == "object"){
49 for(var key in filter){
53 for(i = 0; arg = arguments[i]; i++){
54 if(typeof arg == "string"){
60 for(i = 0, key; key = keys[i]; i++){
61 context[key] = this[key];
66 setThis: function(/*Object*/ _this){
72 hasKey: function(key){
73 if(typeof this[key] != "undefined"){
77 for(var i = 0, dict; dict = this._dicts[i]; i++){
78 if(typeof dict[key] != "undefined"){