Package Exports
- dom-lib
- dom-lib/lib/WheelHandler
- dom-lib/lib/animation/cancelAnimationFramePolyfill
- dom-lib/lib/animation/requestAnimationFramePolyfill
- dom-lib/lib/query/canUseDOM
- dom-lib/lib/transition/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-lib

DOM helper library
安装
npm install dom-lib --save
示例
import { addClass } from 'dom-lib';
API
Class
hasClass: (node: HTMLElement, className: string) => boolean;
addClass: (node: HTMLElement, className: string) => HTMLElement;
removeClass: (node: HTMLElement, className: string) => HTMLElement;
toggleClass: (node: HTMLElement, className: string) => HTMLElement;
Style
getStyle: (node: HTMLElement, property: string) => string;
getStyle: (node: HTMLElement) => Object;
removeStyle: (node: HTMLElement, property: string) => void;
removeStyle: (node: HTMLElement, propertys: Array<string>) => void;
addStyle: (node: HTMLElement, property: string, value: string) => void;
addStyle: (node: HTMLElement, style: Object) => void;
Events
on: (target: HTMLElement, eventName: string, listener: Function, capture: boolean = false) => {
off: Function;
};
off: (target: HTMLElement, eventName: string, listener: Function, capture: boolean = false) =>
void;
Query
activeElement: () => HTMLElement;
getHeight: (node: HTMLElement, client: HTMLElement) => number;
getWidth: (node: HTMLElement, client: HTMLElement) => number;
getOffset: (node: HTMLElement) => Object;
getOffsetParent: (node: HTMLElement) => Object;
getPosition: (node: HTMLElement, offsetParent) => Object;
getWindow: (node: HTMLElement) => String;
nodeName: (node: HTMLElement) => String;
ownerDocument: (node: HTMLElement) => Object;
ownerWindow: (node: HTMLElement) => Object;
contains: (context: HTMLElement, node: HTMLElement) => boolean;
scrollLeft: (node: HTMLElement) => number;
scrollTop: (node: HTMLElement) => number;
Utils
scrollLeft: (node: HTMLElement, val: number) => void;
scrollTop: (node: HTMLElement, val: number) => void;