Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#16889 closed feature (fixed)

Add _detachTemplateNodes function to _AttachMixin

Reported by: Nick Fenwick Owned by: bill
Priority: undecided Milestone: 1.9
Component: Dijit Version: 1.9.0a2
Keywords: Cc:
Blocked By: Blocking:


_AttachMixin in 1.9 trunk has an _attachTemplateNodes function that sets up this._attachPoints and this._attachEvents, but there is no function to call to easily tear them down again. That code is in destroyRendering().

Our use case is that we have server generated content that contains dijits and attach point markup. We need a way to set that HTML to the dom, have it parsed and its attach points processed. If this is to be repeatable, the old attach points must be torn down somehow.

Our _setContentAttr function currently looks like this:

	return declare(_AttachMixin, {

		/* When our content is being replaced, detach our attach points
		 * and remove our current DOM, then create the new content and
		 * place it where the old content used to be.
		_setContentAttr: function(content) {

			html.set(this.domNode, content);


				this.domNode, function(n,p){ return n.getAttribute(p); });

			// Allow _WidgetsInTemplateMixin to attach dijits in this template
			this._beforeFillContent();		// hook for _WidgetsInTemplateMixin

			// Force startup to be called on e.g. TabContainers in our template
			// _WITM will have created them, but not called startup(), so
			// TabContainer et al don't fully set up.
			// Could also set _earlyTemplatedStartup, see _WITM.


To support this behaviour, we need the _AttachMixin._detachTemplateNodes function that I had in my local copy while developing

Attachments (1)

16889.patch (820 bytes) - added by Nick Fenwick 9 years ago.
Patch to _AttachMixin.js on dijit trunk.

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by Nick Fenwick

Attachment: 16889.patch added

Patch to _AttachMixin.js on dijit trunk.

comment:1 Changed 9 years ago by bill

Resolution: fixed
Status: newclosed

In [30934]:

Move code to remove attach points and events to separate method, so it can be called independently of destroyRendering(), fixes #16889 !strict.

Also removing redundant call to this.own(), from [30465], refs #16585.

comment:2 Changed 9 years ago by bill

Milestone: tbd1.9

comment:3 Changed 9 years ago by bill

#11767 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.