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

  • 1.1.0-beta
  • 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

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;

FAQs

Package last updated on 15 Dec 2018

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