Utility object for dom-related utilities. Note that this is not a Class, and so does
not need to be instantiated before use.
- Since:
- 1.0.42
- Copyright:
- Copyright (C) 2005-2020 Alfresco Software Limited
- License:
- GNU Lesser General Public License, see: Open Source Licensing
- Source:
Methods
-
addObjectResizeListener(node, resizeHandler) → {object}
-
In IE9+ and Chrome/FF, setup a listener on a specific node that will call the supplied handler-function whenever that node resizes
NOTE: This is based on a technique described at http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection
WARNING: This is NOT scalable, as it adds approx 500KB to the page's memory usage every time it's used, however it has been left here in case it's more suitable than polling, which might be the case for very limited usage as there's no polling overhead associated with this technique.
Parameters:
Name Type Description node
object The node to monitor resizeHandler
function The function to call on resize - Since:
- 1.0.43
- Source:
Returns:
A pointer to the listener, with a remove function on it (i.e. it can be passed to this.own)- Type
- object
-
addPollingResizeListener(node, resizeHandler) → {object}
-
Setup a listener on a specific node that will call the supplied handler-function whenever that node resizes. This works by having a single "process" polling every 100ms and then checking all registered nodes for size-changes.
Parameters:
Name Type Description node
object The node to monitor resizeHandler
function The function to call on resize - Since:
- 1.0.43
- Source:
Returns:
A pointer to the listener, with a remove function on it (i.e. it can be passed to this.own)- Type
- object
-
addResizeListener(node, resizeHandler) → {object}
-
See the replacement addPollingResizeListener for more information.
Parameters:
Name Type Description node
object The node to monitor resizeHandler
function The function to call on resize - Deprecated:
- Since 1.0.43 - Use addPollingResizeListener instead
- Source:
Returns:
A pointer to the listener, with a remove function on it (i.e. it can be passed to this.own)- Type
- object
-
describeNode(node, includeAttrs) → {string}
-
Given a node in the document, return a string that identifies that node as much as possible.
Parameters:
Name Type Argument Default Description node
object The node to describe includeAttrs
boolean <optional>
false Include the attributes in the description - Since:
- 1.0.48
- Source:
Returns:
The description of the node, e.g. 'div#myId.class1.class2[tabindex=0]' or "my string"- Type
- string
-
ignoreResizes(nodes)
-
Given a domNode, disable resize listening on that node temporarily.
Parameters:
Name Type Description nodes
object | Array.<object> The node or nodes to disable resize-listening on. - Since:
- 1.0.46
- Source:
-
noticeResizes(nodes)
-
Given a domNode, re-enable resize listening on that node. Note that this will not add a new resize listener to a node, merely re-enable an existing, disabled one.
Parameters:
Name Type Description nodes
object | Array.<object> The node or nodes to re-enable resize-listening on. - Since:
- 1.0.46
- Source: