rem: var oldNode = sourceNodeRef.parentNode.replaceChild(this.domNode, sourceNodeRef); 
add: this._sourceNodeRef = dojo.dom.replaceNode(sourceNodeRef, this.domNode); 
context: 		postInitialize: function(/*Object*/args, /*Object*/frag, /*Widget*/parentComp){			// summary:			//		Replace the source domNode with the generated dom			//		structure, and register the widget with its parent.			//		This is an implementation of the stub function defined in			//		dojo.widget.Widget.						//dojo.profile.start(this.widgetType + " postInitialize");						var sourceNodeRef = this.getFragNodeRef(frag);			// Stick my generated dom into the output tree			//alert(this.widgetId + ": replacing " + sourceNodeRef + " with " + this.domNode.innerHTML);			if (parentComp && (parentComp.snarfChildDomOutput || !sourceNodeRef)){				// Add my generated dom as a direct child of my parent widget				// This is important for generated widgets, and also cases where I am generating an				// <li> node that can't be inserted back into the original DOM tree				parentComp.addWidgetAsDirectChild(this, "", "insertAtIndex", "",  args["dojoinsertionindex"], sourceNodeRef);			} else if (sourceNodeRef){				// Do in-place replacement of the my source node with my generated dom				if(this.domNode && (this.domNode !== sourceNodeRef)){					var oldNode = sourceNodeRef.parentNode.replaceChild(this.domNode, sourceNodeRef);				}			}			// Register myself with my parent, or with the widget manager if			// I have no parent			// TODO: the code below erroneously adds all programatically generated widgets			// to topWidgets (since we don't know who the parent is until after creation finishes)			if ( parentComp ) {				parentComp.registerChild(this, args.dojoinsertionindex);			} else {				dojo.widget.manager.topWidgets[this.widgetId]=this;			}			if(this.widgetsInTemplate){				var parser = new dojo.xml.Parse();				var subContainerNode;				//TODO: use xpath here?				var subnodes = this.domNode.getElementsByTagName("*");				for(var i=0;i<subnodes.length;i++){					if(subnodes[i].getAttribute('dojoAttachPoint') == 'subContainerWidget'){						subContainerNode = subnodes[i];//						break;					}					if(subnodes[i].getAttribute('dojoType')){						subnodes[i].setAttribute('_isSubWidget', true);					}				}				if (this.isContainer && !this.containerNode){					//no containerNode is available, which means a widget is used as a container. find it here and move					//all dom nodes defined in the main html page as children of this.domNode into the actual container					//widget's node (at this point, the subwidgets defined in the template file is not parsed yet)					if(subContainerNode){						var src = this.getFragNodeRef(frag);						if (src){							dojo.dom.moveChildren(src, subContainerNode);							//do not need to follow children nodes in the main html page, as they							//will be dealt with in the subContainerWidget							frag['dojoDontFollow'] = true;						}					}else{						dojo.debug("No subContainerWidget node can be found in template file for widget "+this);					}				}				var templatefrag = parser.parseElement(this.domNode, null, true);				// createSubComponents not createComponents because frag has already been created				dojo.widget.getParser().createSubComponents(templatefrag, this);					//find all the sub widgets defined in the template file of this widget				var subwidgets = [];				var stack = [this];				var w;				while((w = stack.pop())){					for(var i = 0; i < w.children.length; i++){						var cwidget = w.children[i];						if(cwidget._processedSubWidgets || !cwidget.extraArgs['_issubwidget']){ continue; }						subwidgets.push(cwidget);						if(cwidget.isContainer){							stack.push(cwidget);						}					}				}					//connect event to this widget/attach dom node				for(var i = 0; i < subwidgets.length; i++){					var widget = subwidgets[i];					if(widget._processedSubWidgets){						dojo.debug("This should not happen: widget._processedSubWidgets is already true!");						return;					}					widget._processedSubWidgets = true;					if(widget.extraArgs['dojoattachevent']){						var evts = widget.extraArgs['dojoattachevent'].split(";");						for(var j=0; j<evts.length; j++){							var thisFunc = null;							var tevt = dojo.string.trim(evts[j]);							if(tevt.indexOf(":") >= 0){								// oh, if only JS had tuple assignment								var funcNameArr = tevt.split(":");								tevt = dojo.string.trim(funcNameArr[0]);								thisFunc = dojo.string.trim(funcNameArr[1]);							}							if(!thisFunc){								thisFunc = tevt;							}							if(dojo.lang.isFunction(widget[tevt])){								dojo.event.kwConnect({									srcObj: widget, 									srcFunc: tevt, 									targetObj: this, 									targetFunc: thisFunc								});							}else{								alert(tevt+" is not a function in widget "+widget);							}						}					}						if(widget.extraArgs['dojoattachpoint']){						//don't attach widget.domNode here, as we do not know which						//dom node we should connect to (in checkbox widget case, 						//it is inputNode). So we make the widget itself available						this[widget.extraArgs['dojoattachpoint']] = widget;					}				}			}			//dojo.profile.end(this.widgetType + " postInitialize");			// Expand my children widgets			/* dojoDontFollow is important for a very special case			 * basically if you have a widget that you instantiate from script			 * and that widget is a container, and it contains a reference to a parent			 * instance, the parser will start recursively parsing until the browser			 * complains.  So the solution is to set an initialization property of 			 * dojoDontFollow: true and then it won't recurse where it shouldn't			 */			if(this.isContainer && !frag["dojoDontFollow"]){				//alert("recurse from " + this.widgetId);				// build any sub-components with us as the parent				dojo.widget.getParser().createSubComponents(frag, this);			}		},
meta: 4707	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/4707/50c3492c4c3c825dbd3401e134a19ed46799c456/DomWidget.js/clean/www/resources/dojo-ajax/src/widget/DomWidget.js