Class: DomUtil

DomUtil

  • new DomUtil() [source]

  • DOM utilities used internally. Learned a lot from Leaflet.DomUtil

    Members

  • (static, constant) exports.TRANSFORM :String

  • Vendor-prefixed fransform style name (e.g. `'webkitTransform'` for WebKit).
    Type:
    • String
    Properties:
    Name Type Description
    TRANSFORM String
    Source:

  • (static, constant) exports.TRANSFORMORIGIN :String

  • Vendor-prefixed tfransform-origin name (e.g. `'webkitTransformOrigin'` for WebKit).
    Type:
    • String
    Properties:
    Name Type Description
    TRANSFORMORIGIN String
    Source:

  • (static, constant) exports.TRANSITION :String

  • Vendor-prefixed transition name (e.g. `'WebkitTransition'` for WebKit).
    Type:
    • String
    Properties:
    Name Type Description
    TRANSITION String
    Source:

  • (static, constant) exports.CSSFILTER :String

  • Vendor-prefixed filter name (e.g. `'WebkitFilter'` for WebKit).
    Type:
    • String
    Properties:
    Name Type Description
    FILTER String
    Source:

    Static Methods

  • (static) exports.createEl(tagName) [source]

  • Create a html element.
    Parameter Type Description
    tagName String
    Returns:
    HTMLElement:
  • (static) exports.createElOn(tagName, style, container) [source]

  • Create a html element on the specified container
    Parameter Type Description
    tagName String
    style String css styles
    container HTMLElement
    Returns:
    HTMLElement:
  • (static) exports.addDomEvent(obj, typeArr, handler, context) [source]

  • Adds a event listener to the dom element.
    Parameter Type Description
    obj HTMLElement dom element to listen on
    typeArr String event types, seperated by space
    handler function listener function
    context Object function context

  • (static) exports.removeDomEvent(obj, typeArr, handler) [source]

  • Removes event listener from a dom element
    Parameter Type Description
    obj HTMLElement dom element
    typeArr String event types, separated by space
    handler function listening function

  • (static) exports.listensDomEvent(obj, typeArr, handler) [source]

  • Check if event type of the dom is listened by the handler
    Parameter Type Description
    obj HTMLElement dom element to check
    typeArr String event
    handler function the listening function
    Returns:
    Number: - the handler's index in the listener chain, returns -1 if not.
  • (static) exports.preventDefault(event) [source]

  • Prevent default behavior of the browser.
    preventDefault Cancels the event if it is cancelable, without stopping further propagation of the event.
    Parameter Type Description
    event Event browser event

  • (static) exports.stopPropagation(e) [source]

  • Stop browser event propagation
    Parameter Type Description
    e Event browser event.

  • (static) exports.offsetDom(dom, offsetopt) [source]

  • Get the dom element's current position or offset its position by offset
    Parameter Type Default Description
    dom HTMLElement HTMLElement
    offset opt Point null position to set.
    Returns:
    Point: - dom element's current position if offset is null.
  • (static) exports.computeDomPosition(dom) [source]

  • Compute dom's position
    Parameter Type Description
    dom HTMLElement
    Returns:
    Array.<Number>:
  • (static) exports.getEventContainerPoint(ev) [source]

  • Get event's position from the top-left corner of the dom container
    Parameter Type Description
    ev Event event
    Returns:
    Point:
  • (static) exports.setStyle(dom, strCss) [source]

  • set css style to the dom element
    Parameter Type Description
    dom HTMLElement dom element
    strCss String css text

  • (static) exports.hasClass(el, name) [source]

  • Whether the dom has the given css class.
    Parameter Type Description
    el HTMLElement HTML Element
    name String css class

  • (static) exports.addClass(el, name) [source]

  • add css class to dom element
    Parameter Type Description
    el HTMLElement HTML Element
    name String css class

  • (static) exports.setClass(el, name) [source]

  • Set dom's css class
    Parameter Type Description
    el HTMLElement HTML Element
    name String css class

  • (static) exports.getClass(name) [source]

  • Get dom's css class
    Parameter Type Description
    name String css class

  • (static) exports.setTransform(el, offset) [source]

  • Resets the 3D CSS transform of `el` so it is translated by `offset` pixels
    Parameter Type Description
    el HTMLElement
    offset Point