Jaxer.Util.DOM : Object
Return to: Jaxer Framework index

Namespace used to hold functions and other objects that extend JavaScript's DOM capabilities.

Platform Support

Jaxer Server FrameworkJaxer Client Framework
1.0no

Functions

MethodActionJaxer Server FrameworkJaxer Client Framework
static createScript(Document doc, String contents, [Object attributes]) : ScriptElement
Create a new script element with the specified content and attributes
Show Details1.0no

Parameters
DocumentdocThe DocumentElement to use when creating elements for the active document.
StringcontentsThe text content for the script element. This value will be set via innerHTML once the new script element has been created
Objectattributes(optional)A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values. If this is omitted, a default type attribute will be used if set in Jaxer.Config.DEFAULT_EMITTED_SCRIPT_TYPE

Returns
ScriptElementThe new script element with content and attributes applied.

static hashToAttributesString(Object hash) : String
Convert an object's properties and property values into a string of attributes suitable for use in creating a string representation of an HTMLElement. Each property is used as the attribute name and each property value becomes the attribute value. Attribute values are surrounding in double-quotes and all property values containing double-quotes will have those characters escaped with backslashes.
Show Details1.0no

Parameters
ObjecthashThe source object

Returns
StringThe resulting string of attribute name/value pairs

static insertScriptAfter(Object contents, Node elt, [Object attributes]) : ScriptElement
Creates a new script element and adds it as the next sibling of the specified element in the DOM.
Show Details1.0no

Parameters
ObjectcontentsThe text content for the script element. This value will be set via innerHTML once the new script element has been created
NodeeltThe element in the DOM after which the new script element will be inserted
Objectattributes(optional)A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values

Returns
ScriptElementThe new script element with content and attributes applied.

static insertScriptAtBeginning(Object contents, Node elt, [Object attributes]) : ScriptElement
Creates a new script element and adds it as the first child of a specified element in the DOM.
Show Details1.0no

Parameters
ObjectcontentsThe text content for the script element. This value will be set via innerHTML once the new script element has been created
NodeeltThe element in the DOM where the new script element will be added as the element's first child.
Objectattributes(optional)A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values

Returns
ScriptElementThe new script element with content and attributes applied.

static insertScriptAtEnd(Object contents, Node elt, [Object attributes]) : ScriptElement
Creates a new script element and adds it as the last child of a specified element in the DOM.
Show Details1.0no

Parameters
ObjectcontentsThe text content for the script element. This value will be set via innerHTML once the new script element has been created
NodeeltThe element in the DOM where the new script element will be added as the element's last child.
Objectattributes(optional)A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values

Returns
ScriptElementThe new script element with content and attributes applied.

static insertScriptBefore(Object contents, Node elt, [Object attributes]) : ScriptElement
Creates a new script element and adds it before a specified element in the DOM.
Show Details1.0no

Parameters
ObjectcontentsThe text content for the script element. This value will be set via innerHTML once the new script element has been created
NodeeltThe element in the DOM before which the new script element will be inserted
Objectattributes(optional)A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values

Returns
ScriptElementThe new script element with content and attributes applied.

static replaceWithScript(Object contents, Node elt, [Object attributes]) : ScriptElement
Replace a specified element in the DOM with a new script element.
Show Details1.0no

Parameters
ObjectcontentsThe text content for the script element. This value will be set via innerHTML once the new script element has been created
NodeeltThe element to replace with the a script element
Objectattributes(optional)A list of attributes and attribute values to apply to the new ScriptElement. Each property name will become the attribute name and each property value will become that attributes value. Note that no escaping is done on the attributes values, so it is expected those values are valid attribute values

Returns
ScriptElementThe new script element with content and attributes applied.

static toHTML(Node node) : String
Returns the serialized HTML of the given node and its contents, much like the outerHTML property in IE. You can also pass the entire document as the node to get the entire HTML of the document (page).
Show Details1.0no

Parameters
NodenodeThe HTML element or document (or DOM node) to be serialized

Returns
StringThe HTML text

aptana_docs