safely removes all children of the node.
Parameter | Type | Description |
---|---|---|
node | DOMNode | String | a reference to a DOM node or an id. |
Destroy node's children byId:
require(["dojo/dom-construct"], function(domConstruct){ domConstruct.empty("someId"); });
removes !DOCTYPE and title elements from the html string.
khtml is picky about dom faults, you can't attach a style or <title>
node as child of body
must go into head, so we need to cut out those tags
Parameter | Type | Description |
---|---|---|
cont | String | An html string for insertion into the dom |
inserts the given content into the given node
Parameter | Type | Description |
---|---|---|
node | DomNode | the parent element |
cont | String | DomNode | NodeList |
the parent element
inserts (replaces) the given content into the given node. dojo/dom-construct.place(cont, node, "only") may be a better choice for simple HTML insertion.
Unless you need to use the params capabilities of this method, you should use dojo/dom-construct.place(cont, node, "only"). dojo/dom-construct..place() has more robust support for injecting an HTML string into the DOM, but it only handles inserting an HTML string as DOM elements, or inserting a DOM node. dojo/dom-construct..place does not handle NodeList insertions dojo/dom-construct.place(cont, node, "only"). dojo/dom-construct.place() has more robust support for injecting an HTML string into the DOM, but it only handles inserting an HTML string as DOM elements, or inserting a DOM node. dojo/dom-construct.place does not handle NodeList insertions or the other capabilities as defined by the params object for this method.
Parameter | Type | Description |
---|---|---|
node | DomNode | the parent element that will receive the content |
cont | String | DomNode | NodeList | the content to be set on the parent element. This can be an html string, a node reference or a NodeList, dojo/NodeList, Array or other enumerable list of nodes |
params | Object |
Optional Optional flags/properties to configure the content-setting. See dojo/html/_ContentSetter |
A safe string/node/nodelist content replacement/injection with hooks for extension Example Usage:
html.set(node, "some string"); html.set(node, contentNode, {options}); html.set(node, myNode.childNodes, {options});