JSPM

  • Created
  • Published
  • Downloads 100960
  • Score
    100M100P100Q146961F
  • License MIT

DOM helper library

Package Exports

  • dom-lib
  • dom-lib/DOMMouseMoveTracker
  • dom-lib/PointerMoveTracker
  • dom-lib/WheelHandler
  • dom-lib/addClass
  • dom-lib/addStyle
  • dom-lib/canUseDOM
  • dom-lib/cancelAnimationFramePolyfill
  • dom-lib/cjs/DOMMouseMoveTracker.js
  • dom-lib/cjs/PointerMoveTracker.js
  • dom-lib/cjs/WheelHandler.js
  • dom-lib/cjs/addClass.js
  • dom-lib/cjs/addStyle.js
  • dom-lib/cjs/canUseDOM.js
  • dom-lib/cjs/cancelAnimationFramePolyfill.js
  • dom-lib/cjs/contains.js
  • dom-lib/cjs/getAnimationEnd.js
  • dom-lib/cjs/getContainer.js
  • dom-lib/cjs/getHeight.js
  • dom-lib/cjs/getOffset.js
  • dom-lib/cjs/getPosition.js
  • dom-lib/cjs/getScrollbarSize.js
  • dom-lib/cjs/getStyle.js
  • dom-lib/cjs/getTransitionEnd.js
  • dom-lib/cjs/getWidth.js
  • dom-lib/cjs/hasClass.js
  • dom-lib/cjs/index.js
  • dom-lib/cjs/isOverflowing.js
  • dom-lib/cjs/nodeName.js
  • dom-lib/cjs/on.js
  • dom-lib/cjs/ownerDocument.js
  • dom-lib/cjs/removeClass.js
  • dom-lib/cjs/removeStyle.js
  • dom-lib/cjs/requestAnimationFramePolyfill.js
  • dom-lib/cjs/scrollLeft.js
  • dom-lib/cjs/scrollTop.js
  • dom-lib/cjs/translateDOMPositionXY.js
  • dom-lib/contains
  • dom-lib/esm/DOMMouseMoveTracker.js
  • dom-lib/esm/PointerMoveTracker.js
  • dom-lib/esm/WheelHandler.js
  • dom-lib/esm/addClass.js
  • dom-lib/esm/addStyle.js
  • dom-lib/esm/canUseDOM.js
  • dom-lib/esm/cancelAnimationFramePolyfill.js
  • dom-lib/esm/contains.js
  • dom-lib/esm/getAnimationEnd.js
  • dom-lib/esm/getContainer.js
  • dom-lib/esm/getHeight.js
  • dom-lib/esm/getOffset.js
  • dom-lib/esm/getPosition.js
  • dom-lib/esm/getScrollbarSize.js
  • dom-lib/esm/getStyle.js
  • dom-lib/esm/getTransitionEnd.js
  • dom-lib/esm/getWidth.js
  • dom-lib/esm/hasClass.js
  • dom-lib/esm/index.js
  • dom-lib/esm/isOverflowing.js
  • dom-lib/esm/nodeName.js
  • dom-lib/esm/on.js
  • dom-lib/esm/ownerDocument.js
  • dom-lib/esm/removeClass.js
  • dom-lib/esm/removeStyle.js
  • dom-lib/esm/requestAnimationFramePolyfill.js
  • dom-lib/esm/scrollLeft.js
  • dom-lib/esm/scrollTop.js
  • dom-lib/esm/translateDOMPositionXY.js
  • dom-lib/getAnimationEnd
  • dom-lib/getContainer
  • dom-lib/getHeight
  • dom-lib/getOffset
  • dom-lib/getPosition
  • dom-lib/getScrollbarSize
  • dom-lib/getStyle
  • dom-lib/getTransitionEnd
  • dom-lib/getWidth
  • dom-lib/hasClass
  • dom-lib/isOverflowing
  • dom-lib/nodeName
  • dom-lib/on
  • dom-lib/ownerDocument
  • dom-lib/removeClass
  • dom-lib/removeStyle
  • dom-lib/requestAnimationFramePolyfill
  • dom-lib/scrollLeft
  • dom-lib/scrollTop
  • dom-lib/translateDOMPositionXY

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dom-lib) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

DOM helper library

CI NPM Version

Click the "Exports" link in the sidebar to see a complete list of everything in the package.

Install

npm install dom-lib --save

Usage

import addClass from 'dom-lib/addClass';

addClass(element, 'foo');
// output: <div class="foo"></div>

API

Class

hasClass: (node: Element, className: string) => boolean;
addClass: (node: Element, className: string) => Element;
removeClass: (node: Element, className: string) => Element;
toggleClass: (node: Element, className: string) => Element;

Style

getStyle: (node: Element, property: string) => string;
getStyle: (node: Element) => Object;

removeStyle: (node: Element, property: string) => void;
removeStyle: (node: Element, propertys: Array<string>) => void;

addStyle: (node: Element, property: string, value: string) => void;
addStyle: (node: Element, style: Object) => void;

Events

on: (target: Element, eventName: string, listener: Function, capture: boolean = false) => {
  off: Function;
};
off: (target: Element, eventName: string, listener: Function, capture: boolean = false) =>
  void;

Query

activeElement: () => Element;
getHeight: (node: Element, client: Element) => number;
getWidth: (node: Element, client: Element) => number;
getOffset: (node: Element) => Object;
getOffsetParent: (node: Element) => Object;
getPosition: (node: Element, offsetParent) => Object;
getWindow: (node: Element) => String;
nodeName: (node: Element) => String;
ownerDocument: (node: Element) => Object;
ownerWindow: (node: Element) => Object;
contains: (context: Element, node: Element) => boolean;
scrollLeft: (node: Element) => number;
scrollTop: (node: Element) => number;
isFocusable: (node: Element) => boolean;

Utils

scrollLeft: (node: Element)=> number;
scrollLeft: (node: Element, val: number)=> void;

scrollTop: (node: Element)=> number;
scrollTop: (node: Element, val: number) => void;