Caplin Trader 4.8.0

Class: module:caplin/dom/Utility

module:caplin/dom/Utility

Constructor

new module:caplin/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) addAndRemoveClassNames()

Deprecated:
  • This functionality is now provided by BladeRunnerJS, 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) addClassName()

    Deprecated:
    • This functionality is now provided by BladeRunnerJS, 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) addEventListener()

      Deprecated:
      • This functionality is now provided by BladeRunnerJS, 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) addScrollListener(scrollListener)

        Registers a global listener for mouse scroll events.

        This method is used rather than module:caplin/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:caplin/dom/event/Event#getNormalizedEvent method, since the format of the scroll detail differs so widely.

        Parameters:
        Name Type Description
        scrollListener function

        (static) createMethodEventListener(obj, method, staticArgumentsopt) → {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 now provided by BladeRunnerJS, 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) getAncestorElementWithClass()

          Deprecated:
          • This functionality is now provided by BladeRunnerJS, 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) getComputedStyle(element, styleName) → {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) getElementOffsetValues()

            Deprecated:
            • This functionality is now provided by BladeRunnerJS, 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) getElementPosition()

              Deprecated:
              • This functionality is now provided by BladeRunnerJS, 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) getElementsByClassName()

                Deprecated:
                • This functionality is now provided by BladeRunnerJS, 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) getLastChildWithClassName(parentElement, className) → {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) getMousePosition(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) getNodeIndex()

                  Deprecated:
                  • This functionality is now provided by BladeRunnerJS, 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) getScrollBarWidth() → {String}

                    Returns the computed current width of scrollBar.
                    Returns:
                    value with unit, to get the value only use parseInt.
                    Type
                    String

                    (static) getScrollOffset()

                    Deprecated:
                    • This functionality is now provided by BladeRunnerJS, 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) hasClassName()

                      Deprecated:
                      • This functionality is now provided by BladeRunnerJS, 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) insertAfter()

                        Deprecated:
                        • This functionality is now provided by BladeRunnerJS, 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) isElementAncestorOfElement()

                          Deprecated:
                          • This functionality is now provided by BladeRunnerJS, 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) isMouseLeaveOrEnter(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) preventEventDefault()

                            Deprecated:
                            • This functionality is now provided by BladeRunnerJS, 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) removeChild()

                              Deprecated:
                              • This functionality is now provided by BladeRunnerJS, 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) removeClassName()

                                Deprecated:
                                • This functionality is now provided by BladeRunnerJS, 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) removeEventListener(targetElem, eventName, eventListener)

                                  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:caplin/dom/Utility.removeEventListenerById to remove an event listener.

                                    (static) removeEventListenerById()

                                    Deprecated:
                                    • This functionality is now provided by BladeRunnerJS, 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) replaceClassName()

                                      Deprecated:
                                      • This functionality is now provided by BladeRunnerJS, 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) setInnerHtml()

                                        Deprecated:
                                        • This functionality is now provided by BladeRunnerJS, 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) stopEventPropagation()

                                          Deprecated:
                                          • This functionality is now provided by BladeRunnerJS, and this proxy method will be removed from CaplinTrader in a future release. Please update any references to this method in your code.
                                            See: