Opened 13 years ago

Closed 12 years ago

#3387 closed enhancement (fixed)

implement scoped <script type="dojo/connect"> system for declaratively created instances

Reported by: alex Owned by: alex
Priority: high Milestone: 0.9
Component: Core Version: 0.9
Keywords: parser, markup, behavior, widget, 4dijit Cc: owenw
Blocked By: Blocking:

Description

as discussed at length with owen and eugene, the system needs to augment programmatic widget and class instance creation with the ability to specify behaviors for instances in a declaration. These behaviors should be scoped correctly.

Change History (7)

comment:1 Changed 13 years ago by alex

(In [9062]) first cut of a <script type="dojo/connect"> system. Refs #3387

comment:2 Changed 13 years ago by alex

(In [9064]) source -> event as per discussion w/ Owen. Refs #3387

comment:3 Changed 13 years ago by guest

There is a bug in the committed code

suffic should be suffix ->

	function wireUpConnect(instance, script){
		var withStr = script.getAttribute("with");
		var preamble = "";
		var suffix = "";
		if(withStr && withStr.length){
			dojo.forEach(withStr.split(/s*,s*/), function(part){
				preamble += "with("+part+"){";
				suffic += "}";
			});
		}

comment:4 Changed 13 years ago by guest

oh - by the way, is it possible to get a personalised trac account ?

i'm cameron@…

cheers.

comment:5 Changed 13 years ago by alex

(In [9115]) thanks to Cameron Braid for spotting this typo. Refs #3387

comment:6 Changed 12 years ago by bill

Keywords: 4dijit added

Alex and I discussed this feature a week or two ago. I think the conclusions were:

  • change <script type="dojo/connect"> to <script type="dojo/method">, since users will be overriding methods more often than connecting to them.
  • specify argument list like <script type="dojo/method" ... args="a,b,c">
  • the specified methods get mixed in to the widget instance the same way as <button dojoType=... onclick="..."> gets mixed in
  • if you need code to execute before the constructor then connect to preamble

comment:7 Changed 12 years ago by alex

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.