Class orion.webui.littlelib
A small library of DOM and UI helpers.
Defined in: </shared/eclipse/e4/orion/I201404012230/bundles/org.eclipse.orion.client.ui/web/orion/webui/littlelib.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
orion.webui.littlelib.KEY
Holds useful
keyCode values. |
Method Attributes | Method Name and Description |
---|---|
<static> |
orion.webui.littlelib.$(selectors, node)
Alias for
node.querySelector() . |
<static> |
orion.webui.littlelib.$$(selectors, node)
Alias for
node.querySelectorAll() . |
<static> |
orion.webui.littlelib.$$array(selectors, node)
Identical to orion.webui.littlelib.$$, but returns an Array instead of a NodeList.
|
<static> |
orion.webui.littlelib.addAutoDismiss(excludeNodes, dismissFunction)
Adds auto-dismiss functionality to the document.
|
<static> |
orion.webui.littlelib.empty(node)
Removes all children of the given node.
|
<static> |
orion.webui.littlelib.processDOMNodes(node, replaceNodes)
Performs substitution of DOM nodes into textContent within the given node and its descendants.
|
<static> |
orion.webui.littlelib.processTextNodes(node, messages)
Performs substitution of strings into textContent within the given node and its descendants.
|
<static> |
orion.webui.littlelib.removeAutoDismiss(dismissFunction)
Removes all auto-dismiss nodes which trigger the specified dismiss function.
|
<static> |
orion.webui.littlelib.stop(event)
Cancels the default behavior of an event and stops its propagation.
|
Field Detail
<static>
orion.webui.littlelib.KEY
Holds useful
keyCode
values.
Method Detail
<static>
{Element}
orion.webui.littlelib.$(selectors, node)
Alias for
node.querySelector()
.
- Parameters:
- {String} selectors
- Selectors to match on.
- {Node} node Optional, Default: document
- Node to query under.
- Returns:
- {Element}
<static>
{NodeList}
orion.webui.littlelib.$$(selectors, node)
Alias for
node.querySelectorAll()
.
- Parameters:
- {String} selectors
- Selectors to match on.
- {Node} node Optional, Default: document
- Node to query under.
- Returns:
- {NodeList}
<static>
{Element[]}
orion.webui.littlelib.$$array(selectors, node)
Identical to orion.webui.littlelib.$$, but returns an Array instead of a NodeList.
- Parameters:
- {String} selectors
- Selectors to match on.
- {Node} node Optional, Default: document
- Node to query under.
- Returns:
- {Element[]}
<static>
orion.webui.littlelib.addAutoDismiss(excludeNodes, dismissFunction)
Adds auto-dismiss functionality to the document. When a click event occurs whose
target
is not a descendant of
one of the excludeNodes
, the dismissFunction
is invoked.
- Parameters:
- {Node[]} excludeNodes
- Clicks targeting any descendant of these nodes will not trigger the dismissFunction.
- {Function} dismissFunction
- The dismiss handler.
<static>
orion.webui.littlelib.empty(node)
Removes all children of the given node.
- Parameters:
- {Node} node
<static>
orion.webui.littlelib.processDOMNodes(node, replaceNodes)
Performs substitution of DOM nodes into textContent within the given node and its descendants. An occurrence of
${n}
in text content will be replaced by the DOM node replaceNodes[n]
.
This function is recommended for performing rich-text replacement within a localized string. The use of actual DOM nodes avoids the need for embedded HTML in strings.
- Parameters:
- {Node} node
- The node to perform replacement under.
- {Node[]} replaceNodes
- The replacement nodes.
<static>
orion.webui.littlelib.processTextNodes(node, messages)
Performs substitution of strings into textContent within the given node and its descendants. An occurrence of
${n}
in text content will be replaced with the string messages[n]
.
This function is recommended for binding placeholder text in template-created DOM elements to actual display strings.
- Parameters:
- {Node} node
- The node to perform replacement under.
- {String[]} messages
- The replacement strings.
<static>
orion.webui.littlelib.removeAutoDismiss(dismissFunction)
Removes all auto-dismiss nodes which trigger the specified dismiss function.
- Parameters:
- {Function} dismissFunction
- The dismiss function to look for.
<static>
orion.webui.littlelib.stop(event)
Cancels the default behavior of an event and stops its propagation.
- Parameters:
- {Event} event