Static
addAdds css classes to a node, its siblings and the siblings of all parents but not the parents itself.
Node to add class to
Class to add
True to add class to oneself also.
True to skip empty text nodes
Optional
backupList: UFNodeBackup[]Optional backup list
Static
addRecursively adds css classes to a nodes children (and grandchildren). If the child node is a text node, it will get replaced by a wrapping span node with the specified class.
If backupList is set, the method will store the original text node and newly created wrapper nodes in the list. Use restoreNodes to restore the original nodes.
Node to process its children of
Css classes to add
True to skip empty text nodes
Optional
backupList: UFNodeBackup[]Optional backup list
Static
addAdds style rule to class attribute. If the node is a text node, it will be wrapped by a span using wrapTextNode.
If backupList is set, the method will store the original text node and newly created wrapper node in the list. Use restoreNodes to restore the original nodes.
Node to add class to
Css classes to add
True to skip empty text nodes
Optional
backupList: UFNodeBackup[]Optional backup list
node or the new wrapping span node
Static
addAdd css classes to a node and next siblings.
Node to start with
Css classes to add
When true add class to node, else skip oneself.
True to skip empty text nodes
Optional
backupList: UFNodeBackup[]Optional backup list
Static
getGets the index of a node inside the parent node.
Parent node
Node to get index of
index or -1 if not found
Static
getGets the index of a node within its parent.
Node to check
index
Static
positionGets the position inside an element for a specific location.
Code based on: https://github.com/timdown/rangy/blob/master/src/modules/inactive/rangy-position.js
The function returns an object with the following properties:
Document of contents
X position in screen
Y position in screen
When true select element before else select element after if position is in between two elements.
An object with two properties or null if no element could be found at the location.
Static
removeRemoves a css class from a node, its siblings and the siblings of all parents but not the parents itself.
Node to remove class from
class to remove
True to remove class from oneself also.
Static
removeRemoves a css class from a node, its siblings and the siblings of all parents but not the parents itself.
Node to remove class from
Css class to remove
True to remove class from oneself also.
Static
removeRecursively removes css class from a nodes children (and grandchildren).
Node to start with
Class to remove
Static
removeRemove a css class from a node and next siblings.
Node to start with
Css class to remove
When true remove class from node, else skip oneself.
Static
removeRemoves a css class from a node. The css class is only removed if the node is an element.
Node to remove css class from
Css class to remove
Static
removeRemove a css class from a node and previous siblings.
Node to start with
Css class to remove
When true remove class from node, else skip oneself.
When true remove class from the children as well
Static
restoreReplace all replacement nodes with their originals. Then it will set the length property to 0, clearing all stored values.
Array of backup entries as created by the addXXXX methods.
Static
wrapWraps a text node with a span element.
Node to wrap into a span element.
Optional
cssClasses: stringOptional css classes to use for span
New span element
Defines static class UFNode, an utilities library with static methods to work with HTML Nodes.