Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dom-lib

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-lib

DOM helper library

  • 0.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
84K
decreased by-3.22%
Maintainers
1
Weekly downloads
 
Created
Source

dom-lib Travis npm

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)

FAQs

Package last updated on 26 Jun 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc