new module:ct-dom /Utility()
This class provides static, browser agnostic, utility methods for DOM interactions such as adding / removing event listeners, adjusting CSS classes, finding element positions etc.
Methods
(static) add And Remove Class Names()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) add Class Name()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) add Event Listener()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) add Scroll Listener(scroll Listener)
Registers a global listener for mouse scroll events.
This method is used rather than module:ct-dom/Utility#addEventListener
since the registration of mouse scroll events
differs in IE, Opera, and standards compliant browsers. Furthermore, the event parameter passed through as
the first parameter to scrollListener
can be relied upon to exist, even in IE, and has been
pre-normalized using the module:ct-dom/event/Event#getNormalizedEvent
method, since the format
of the scroll detail
differs so widely.
Parameters:
Name | Type | Description |
---|---|---|
scrollListener |
function |
(static) create Method Event Listener(obj, method, static Argumentsopt) → {function}
Creates an event listener (a function pointer) that allows a method to be called on an object when that event is fired.
Normal event listeners are function pointers which make object-oriented programming difficult. The
function pointer returned by this method merely calls the desired method on the specified object so that
the this
pointer is still available.
Each time an event occurs where this event listener has been attached, the method will be called with a
single event parameter, event
, which is the browser event object. Optionally, if
staticArguments
is provided then the arguments within this array will be appended to the
method parameters for each method call.
The last object passed into the callback method method will be the DOM element which triggered the event firing, for example, the button that was clicked or hovered over.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
obj |
Object | the object the method will be called on. |
|
method |
String | the name of the method to call. |
|
staticArguments |
Array |
<optional> |
The arguments that, if provided, will be appended as parameters to the given method. |
Returns:
The event function that will invoke the method on the specified class once the event is fired.
- Type
- function
(static) discard()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) get Ancestor Element With Class()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) get Computed Style(element, style Name) → {String}
Computes current style of a DOM Element, converting it to pixels where appropriate.
Parameters:
Name | Type | Description |
---|---|---|
element |
DOMElement | Element to get style for. |
styleName |
String | Css style name. IE. border-width. |
Returns:
value with unit, to get the value only use parseInt.
- Type
- String
(static) get Element Offset Values()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) get Element Position()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) get Elements ByClass Name()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) get Last Child With Class Name(parent Element, class Name) → {DOMElement}
Returns the last child element that contains the specified CSS class.
Parameters:
Name | Type | Description |
---|---|---|
parentElement |
DOMElement | The parent to use as the root. |
className |
String | The class of the wanted last child element. |
Returns:
The last child element or null.
- Type
- DOMElement
(static) get Mouse Position(event) → {Array}
Returns the mouse position for the specified event.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | The event object for which to get the mouse co-ordinates |
Returns:
[x,y]
- Type
- Array
(static) get Node Index()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) get Scroll Bar Width() → {String}
Returns the computed current width of scrollBar.
Returns:
value with unit, to get the value only use parseInt.
- Type
- String
(static) get Scroll Offset()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) has Class Name()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) insert After()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) is Element Ancestor OfElement()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) is Mouse Leave OrEnter(event, element) → {Boolean}
Determines whether the event is the equivalent of the microsoft mouseleave or mouseenter events. This method assumes the event being passed is a mouseout or mouseenter and has undefined results if this isn't the case.
Parameters:
Name | Type | Description |
---|---|---|
event |
Event | A mouseover or mouseout event object. |
element |
Element | The element we want to test against for mouseenter/mouseleave. |
Returns:
True if the event is either a mouse leave or enter event.
- Type
- Boolean
(static) prevent Event Default()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) remove Child()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) remove Class Name()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) remove Event Listener(target Elem, event Name, event Listener)
Removes the specified event listener function from the element.
Parameters:
Name | Type | Description |
---|---|---|
targetElem |
Element | The element to remove the event from. |
eventName |
String | The name of the event to remove the listener from. |
eventListener |
function | The event listener to remove. |
- Deprecated:
- use removeEventListenerById instead
- See:
-
- module:ct-dom/Utility.removeEventListenerById to remove an event listener.
(static) remove Event Listener ById()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
-
- module:br-util/EventUtility.removeEventListenerById
(static) replace Class Name()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) set Inner Html()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See:
(static) stop Event Propagation()
- Deprecated:
- This functionality is provided by an equivalent 'br-' library, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
- See: