Sha256: 9adc1c93d0070748bcaeb262c721558eabd9249fd194a8e38ed51faa32e6859d

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

dojo.provide("dojox.dtl.Context");
dojo.require("dojox.dtl._base");

dojox.dtl.Context = dojo.extend(function(dict){
	this._this = {};
	dojox.dtl._Context.call(this, dict);
}, dojox.dtl._Context.prototype,
{
	getKeys: function(){
		var keys = [];
		for(var key in this){
			if(this.hasOwnProperty(key) && key != "_dicts" && key != "_this"){
				keys.push(key);
			}
		}
		return keys;
	},
	extend: function(/*dojox.dtl.Context|Object*/ obj){
		// summary: Returns a clone of this context object, with the items from the
		//		passed objecct mixed in.
		return  dojo.delegate(this, obj);
	},
	filter: function(/*dojox.dtl.Context|Object|String...*/ filter){
		// summary: Returns a clone of this context, only containing the items
		//		defined in the filter.
		var context = new dojox.dtl.Context();
		var keys = [];
		var i, arg;
		if(filter instanceof dojox.dtl.Context){
			keys = filter.getKeys();
		}else if(typeof filter == "object"){
			for(var key in filter){
				keys.push(key);
			}
		}else{
			for(i = 0; arg = arguments[i]; i++){
				if(typeof arg == "string"){
					keys.push(arg);
				}
			}
		}

		for(i = 0, key; key = keys[i]; i++){
			context[key] = this[key];
		}

		return context;
	},
	setThis: function(/*Object*/ _this){
		this._this = _this;
	},
	getThis: function(){
		return this._this;
	},
	hasKey: function(key){
		if(typeof this[key] != "undefined"){
			return true;
		}

		for(var i = 0, dict; dict = this._dicts[i]; i++){
			if(typeof dict[key] != "undefined"){
				return true;
			}
		}

		return false;
	}
});

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
dojo_src-1.4.3 dojo/dojox/dtl/Context.js
dojo_src-1.4.102 dojo/dojox/dtl/Context.js
dojo-pkg-1.132.0 data/dojo-release-1.3.2-src/dojox/dtl/Context.js
dojo-pkg-1.120.0 data/dojo-release-1.2.0-src/dojox/dtl/Context.js
dojo-pkg-1.121.0 data/dojo-release-1.2.1-src/dojox/dtl/Context.js
dojo-pkg-1.122.0 data/dojo-release-1.2.2-src/dojox/dtl/Context.js
dojo-pkg-1.123.0 data/dojo-release-1.2.3-src/dojox/dtl/Context.js
dojo-pkg-1.130.0 data/dojo-release-1.3.0-src/dojox/dtl/Context.js
dojo-pkg-1.131.0 data/dojo-release-1.3.1-src/dojox/dtl/Context.js