W3cubDocs

/Dojo

dojo/html

Summary

TODOC

See the dojo/html reference documentation for more information.

Methods

set(node,cont,params)

Defined by dojo/html

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

Returns: undefined

Examples

Example 1

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});

© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/html.html