event.js

来自「ajax框架原吗,dojo目前很流行的,希望大家多多学习啊」· JavaScript 代码 · 共 43 行

JS
43
字号
if(!dojo._hasResource["dojox.dtl.tag.event"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.dojo._hasResource["dojox.dtl.tag.event"] = true;dojo.provide("dojox.dtl.tag.event");dojo.require("dojox.dtl._base");dojox.dtl.tag.event.EventNode = function(type, fn){	this._type = type;	this.contents = fn;}dojo.extend(dojox.dtl.tag.event.EventNode, {	render: function(context, buffer){		if(!this._clear){			buffer.getParent()[this._type] = null;			this._clear = true;		}		if(this.contents && !this._rendered){			if(!context.getThis()) throw new Error("You must use Context.setObject(instance)");			this._rendered = dojo.connect(buffer.getParent(), this._type, context.getThis(), this.contents);		}		return buffer;	},	unrender: function(context, buffer){		if(this._rendered){			dojo.disconnect(this._rendered);			this._rendered = false;		}		return buffer;	},	clone: function(){		return new dojox.dtl.tag.event.EventNode(this._type, this.contents);	},	toString: function(){ return "dojox.dtl.tag.event." + this._type; }});dojox.dtl.tag.event.on = function(parser, text){	// summary: Associates an event type to a function (on the current widget) by name	var parts = text.split(" ");	return new dojox.dtl.tag.event.EventNode(parts[0], parts[1]);}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?