Class Dom
Utility for Nodes
Defined in: dom.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Dom()
|
Field Attributes | Field Name and Description |
---|---|
<static> |
Dom.clearNode
Clears a node
|
<static> |
List of event handlers that are settable via on* DOM properties.
|
<static> | |
<static> | |
<static> | |
<static> |
Dom.hide
Hide or display an element
|
<static> |
Dom.setOuterHTML
Set the outerHTML of kind of element
|
Method Attributes | Method Name and Description |
---|---|
<static> |
Dom.addScript(doc, id, content)
Insert a script element in the document
|
<static> |
Dom.collapse(elt, collapsed)
|
<static> |
Dom.deleteMappedData(node, key)
Deletes the data about the given node.
|
<static> |
Dom.eraseNode(the)
Erases a node
|
<static> |
Dom.getAncestorByClass(node, className)
Gets the ancestor of a node with a specific class name
|
<static> |
Dom.getAncestorByTagName(node, tagName)
Gets the ancestor of a node with a specific tag name
|
<static> |
Dom.getBody(doc)
Gets the body element of an HTML document or the document element for non-HTML documents
|
<static> |
Dom.getChildByClass(elt)
Selects the first child element which matches with the first classname,
then the first child of it which matches with the second classname, and so on.
|
<static> |
Dom.getLTRBWH(elt)
Gets layout info about an element
|
<static> |
Dom.getMappedData(node, key)
Returns stored data about a node.
|
<static> |
Dom.getNextElement(node)
Gets the next element node
|
<static> |
Dom.getOffsetSize(elt)
Gets the offset size of an element
|
<static> |
Dom.getOverflowParent(element)
Gets the next scrollable ancestor
|
<static> |
Dom.getPreviousElement(node)
Gets the previous element node
|
<static> |
Dom.insertAfter(newNode, referenceNode)
Insert the new node after the reference node.
|
<static> |
Dom.insertTextIntoElement(element, text)
TODO.
|
<static> |
Dom.isAncestor(node, potentialAncestor)
Checks whether a node is an ancestor of another node
|
<static> |
Dom.isCollapsed(elt)
|
<static> |
Dom.isNode(obj)
Returns true if the passed object is a node
|
<static> |
Dom.isScrolledToBottom(element)
Checks whether an element is scrolled to the bottom
|
<static> |
Dom.markupToDocFragment(markup, the)
Converts a chunk of HTML code into DOM elements (stored in a document fragment)
|
<static> |
Dom.move(element, x, y)
Moves an element
|
<static> |
Dom.resize(element, w, h)
Resizes an element
|
<static> |
Dom.scrollIntoCenterView(element, scrollBox, notX, notY)
Centers an element inside a scrollable area
|
<static> |
Dom.scrollMenupopup(popup, item)
Scrolls an element of a menu popup into view.
|
<static> |
Dom.scrollTo(element, scrollBox, alignmentX, alignmentY, scrollWhenVisible)
Scrolls an element into view
|
<static> |
Dom.scrollToBottom(element)
Scrolls a scrollable element to the bottom
|
<static> |
Dom.setMappedData(node, key, value)
Stores a data about the given node.
|
Field Detail
<static>
Dom.clearNode
Clears a node
- Deprecated:
-
use the following instead:
node.textContent = "";
<static>
Dom.domInlineEventHandlersMap
List of event handlers that are settable via on* DOM properties.
<static>
Dom.getElementByClass
- Deprecated:
- Use native Firefox node.getElementsByClassName(names).item(0)
<static>
Dom.getElementsByAttribute
- Deprecated:
- Use native Firefox node.getElementsByClassName("[attrName=attrValue]")
<static>
Dom.getElementsByClass
- Deprecated:
- Use native Firefox node.getElementsByClassName(names)
<static>
Dom.hide
Hide or display an element
- Deprecated:
- set elt.style.visibility instead
<static>
Dom.setOuterHTML
Set the outerHTML of kind of element
- Deprecated:
- since Firefox 20, we can use outerHTML instead, even for non-HTML elements
Method Detail
<static>
{Element}
Dom.addScript(doc, id, content)
Insert a script element in the document
- Parameters:
- {DocumentElement} doc
- The document
- {String} id
- The id of the script to insert
- {String} content
- The content of the script (evaluated once the script is inserted)
- Returns:
- {Element} the inserted script
<static>
Dom.collapse(elt, collapsed)
- Parameters:
- elt
- collapsed
- Deprecated:
- xxxFlorent: hide XUL elements?? (TODO)
<static>
Dom.deleteMappedData(node, key)
Deletes the data about the given node.
- Parameters:
- {Node} node
- The node
- {*} key
- The key
<static>
Dom.eraseNode(the)
Erases a node
- Parameters:
- {Node} the
- Node to erase
<static>
{Node}
Dom.getAncestorByClass(node, className)
Gets the ancestor of a node with a specific class name
- Parameters:
- {Node} node
- Child node, for which to search the ancestor
- {String} className
- Class name of ancestor node
- Returns:
- {Node} Ancestor node
<static>
{Node}
Dom.getAncestorByTagName(node, tagName)
Gets the ancestor of a node with a specific tag name
- Parameters:
- {Node} node
- Child node, for which to search the ancestor
- {String} tagName
- Tag name of the ancestor node
- Returns:
- {Node} Ancestor node
<static>
{Node}
Dom.getBody(doc)
Gets the body element of an HTML document or the document element for non-HTML documents
- Parameters:
- {Document} doc
- Document, for which to get the body element or document element
- Returns:
- {Node} Body element or document element
<static>
{Element}
Dom.getChildByClass(elt)
Selects the first child element which matches with the first classname,
then the first child of it which matches with the second classname, and so on...
- Parameters:
- {Element} elt
- The initial parent element
- {String} ...classnames
- the classnames
- Returns:
- {Element} the element matching with the last classname or null
<static>
{Object}
Dom.getLTRBWH(elt)
Gets layout info about an element
- Parameters:
- {Object} elt
- Element to get the info for
- Returns:
- {Object} Layout information including "left", "top", "right", "bottom", "width" and "height"
<static>
{*}
Dom.getMappedData(node, key)
Returns stored data about a node.
- Parameters:
- {Node} node
- The node
- {*} key
- The key
- Returns:
- {*} the data
<static>
{Node}
Dom.getNextElement(node)
Gets the next element node
- Parameters:
- {Node} node
- Node, for which to get the next element node
- Returns:
- {Node} Next element node
<static>
{Object}
Dom.getOffsetSize(elt)
Gets the offset size of an element
- Parameters:
- {Object} elt
- Element to move
- Returns:
- {Object} Offset width and height of the element
<static>
{Object}
Dom.getOverflowParent(element)
Gets the next scrollable ancestor
- Parameters:
- {Object} element
- Element to search the ancestor for
- Returns:
- {Object} Scrollable ancestor
<static>
{Node}
Dom.getPreviousElement(node)
Gets the previous element node
- Parameters:
- {Node} node
- Node, for which to get the previous element node
- Returns:
- {Node} Previous element node
<static>
{Node}
Dom.insertAfter(newNode, referenceNode)
Insert the new node after the reference node.
- Parameters:
- {Node} newNode
- The node to insert
- {Node} referenceNode
- The node after which we insert the new node
- Returns:
- {Node} the new node if the insertion succeeded
<static>
Dom.insertTextIntoElement(element, text)
TODO...
- Parameters:
- element
- text
<static>
{Boolean}
Dom.isAncestor(node, potentialAncestor)
Checks whether a node is an ancestor of another node
- Parameters:
- {Node} node
- Child node, for which to check the ancestor
- {Node} potentialAncestor
- Node to check
- Returns:
- {Boolean} True if 'potentialAncestor' is an ancestor of 'node', otherwise false
<static>
Dom.isCollapsed(elt)
- Parameters:
- elt
- Deprecated:
- TODO
<static>
{Boolean}
Dom.isNode(obj)
Returns true if the passed object is a node
- Parameters:
- {Object} obj
- The object to test
- Returns:
- {Boolean} true if the passed object is a node, false otherwise
<static>
{Boolean}
Dom.isScrolledToBottom(element)
Checks whether an element is scrolled to the bottom
- Parameters:
- {Object} element
- Element to check
- Returns:
- {Boolean} True, if element is scrolled to the bottom, otherwise false
<static>
{DocumentFragment}
Dom.markupToDocFragment(markup, the)
Converts a chunk of HTML code into DOM elements (stored in a document fragment)
- Parameters:
- {String} markup
- The HTML code
- {Element} the
- Reference element (often the element which will receive the fragment)
- Returns:
- {DocumentFragment} the document fragment having the generated elements
<static>
Dom.move(element, x, y)
Moves an element
- Parameters:
- {Object} element
- Element to move
- {Number} x
- New horizontal position
- {Number} y
- New vertical position
<static>
Dom.resize(element, w, h)
Resizes an element
- Parameters:
- {Object} element
- Element to resize
- {Number} w
- New width
- {Number} h
- New height
<static>
Dom.scrollIntoCenterView(element, scrollBox, notX, notY)
Centers an element inside a scrollable area
- Parameters:
- {Object} element
- Element to scroll to
- {Object} scrollBox
- Scrolled element (Must be an ancestor of "element" or null for automatically determining the ancestor)
- {Boolean} notX
- Specifies whether the element should be centered horizontally
- {Boolean} notY
- Specifies whether the element should be centered vertically
<static>
Dom.scrollMenupopup(popup, item)
Scrolls an element of a menu popup into view.
- Parameters:
- popup
- item
<static>
Dom.scrollTo(element, scrollBox, alignmentX, alignmentY, scrollWhenVisible)
Scrolls an element into view
- Parameters:
- {Element} element
- Element to scroll to
- {Object} scrollBox
- Scrolled element (Must be an ancestor of "element" or null for automatically determining the ancestor)
- {String} alignmentX
- Horizontal alignment for the element (valid values: "centerOrLeft", "left", "middle", "right", "none")
- {String} alignmentY
- Vertical alignment for the element (valid values: "centerOrTop", "top", "middle", "bottom", "none")
- {Boolean} scrollWhenVisible
- Specifies whether "scrollBox" should be scrolled even when "element" is completely visible
<static>
{Boolean}
Dom.scrollToBottom(element)
Scrolls a scrollable element to the bottom
- Parameters:
- {Object} element
- Element to scroll
- Returns:
- {Boolean} True, if the element could be scrolled to the bottom, otherwise false
<static>
Dom.setMappedData(node, key, value)
Stores a data about the given node.
- Parameters:
- {Node} node
- The node
- {*} key
- The key
- {*} value
- The data to store