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
void hasClass(Element node, String className)
void addClass(Element node, String className)
void removeClass(Element node, String className)
void toggleClass(Element node, String className)
Style
String getStyle(Element node, String property)
Object getStyle(Element node)
String getComputedStyle(Element node, String property)
Object getComputedStyle(Element node)
void removeStyle(Element node, String property)
void removeStyle(Element node, Array propertys)
void addStyle(Element node, String property, String value)
void addStyle(Element node, Object style)
Events
Function on(Element target, String eventName, Function listener, Boolean capture = false)
Function onFocus()
void off(Element target, String eventName, Function listener, Boolean capture = false)
on 和 onFocus 方法将返回一个 off 函数, 用于方便解绑事件
Query
Element activeElement()
Number getHeight(Element node, client)
Number getWidth(Element node, client)
Object getOffset(Element node)
Object getOffsetParent(Element node)
Object getPosition(Element node, offsetParent)
String getWindow(Element node)
String nodeName(Element node)
Object ownerDocument(Element componentOrElement)
Object ownerWindow(Element componentOrElement)
Boolean contains(Element context, Element node)
void scrollLeft(Element node, Number val)
void scrollTop(Element node, Number val)