Dom Node vs VNode manipulatoin


#1

Struggling a bit to get a handle on how to modify document content (add/remove DOM nodes) at runtime as I make the transition from DOJO 1.x to DOJO 2/3.

For example, at startup, we have a document that includes SVG content (built with HTML source) and some DOJO 3 widgets with control buttons and an initially empty ‘svg canvas’ work area (empty div element) created during the top widget’s render method.

I want a user to click a button, and then move that SVG content from its initial area onto the DOJO 3 ‘svg canvas’ widget (for editing purposes). If this were simple Javascript, I’d clone or move the SVG node and add it as a child to the div (svg canvas) element.

Is that type of DOM manipulation (using getELementByID, add DOM node’s) still OK as ‘standard practice’ with DOJO 3; if not what is the best practice to move a DOM node into the tree of DOJO 3 widgets?


#2

I would check out https://github.com/dojo/framework/blob/master/src/widget-core/README.md#inserting-dom-nodes-into-the-vdom-tree which I believe answers your questions. Let me know if anything isn’t clear fromt his info!

-Dylan