source: [view]
this.parent = buffer.getParent();
if(this.options.node){
this.onAddNode = dojo.connect(buffer, "onAddNode", dojo.hitch(this, "_swap", "node"));
this.onRemoveNode = dojo.connect(buffer, "onRemoveNode", dojo.hitch(this, "_swap", "node"));
}
if(this.options.text){
this.onChangeData = dojo.connect(buffer, "onChangeData", dojo.hitch(this, "_swap", "node"));
}
if(this.options["class"]){
this.onChangeAttribute = dojo.connect(buffer, "onChangeAttribute", dojo.hitch(this, "_swap", "class"));
}
buffer = this.nodelist.render(context, buffer);
if(this.swapped){
this.swapped.parentNode.replaceChild(this.parent, this.swapped);
dojo.destroy(this.swapped);
}else{
this.onAddNode && dojo.disconnect(this.onAddNode);
this.onRemoveNode && dojo.disconnect(this.onRemoveNode);
this.onChangeAttribute && dojo.disconnect(this.onChangeAttribute);
this.onChangeData && dojo.disconnect(this.onChangeData);
}
delete this.parent;
delete this.swapped;
return buffer;