Methods
attrs()
Function: attrs Add or modify attributes of the current element.
The attributes should be passed in object notation. This function does not move the current element pointer.
Parameters: (Object) moreattrs - The attributes to add/modify in object notation.
Returns: The Strophe.Builder object.
c()
Function: c Add a child to the current element and make it the new current element.
This function moves the current element pointer to the child, unless text is provided. If you need to add another child, it is necessary to use up() to go back to the parent in the tree.
Parameters: (String) name - The name of the child. (Object) attrs - The attributes of the child in object notation. (String) text - The text to add to the child.
Returns: The Strophe.Builder object.
cnode()
Function: cnode Add a child to the current element and make it the new current element.
This function is the same as c() except that instead of using a name and an attributes object to create the child it uses an existing DOM element object.
Parameters: (XMLElement) elem - A DOM element.
Returns: The Strophe.Builder object.
h()
Function: h Replace current element contents with the HTML passed in.
This does not make the child the new current element
Parameters: (String) html - The html to insert as contents of current element.
Returns: The Strophe.Builder object.
root()
Function: root Make the root element the new current element.
When at a deeply nested element in the tree, this function can be used to jump back to the root of the tree, instead of having to repeatedly call up().
Returns: The Stophe.Builder object.
t()
Function: t Add a child text element.
This does not make the child the new current element since there are no children of text elements.
Parameters: (String) text - The text data to append to the current element.
Returns: The Strophe.Builder object.
toString()
Function: toString Serialize the DOM tree to a String.
This function returns a string serialization of the current DOM tree. It is often used internally to pass data to a Strophe.Request object.
Returns: The serialized DOM tree in a String.
tree()
Function: tree Return the DOM tree.
This function returns the current DOM tree as an element object. This is suitable for passing to functions like Strophe.Connection.send().
Returns: The DOM tree as a element object.
up()
Function: up Make the current parent element the new current element.
This function is often used after c() to traverse back up the tree. For example, to add two children to the same element
builder.c('child1', {}).up().c('child2', {});
Returns: The Stophe.Builder object.