3.3.1 • Published 2 months ago

dom-lib v3.3.1

Weekly downloads
14,989
License
MIT
Repository
github
Last release
2 months ago

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;
3.3.1

2 months ago

3.3.0

2 months ago

3.2.0

4 months ago

3.1.6

1 year ago

3.1.5

1 year ago

3.1.4

1 year ago

3.1.3

2 years ago

3.0.1

2 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.1.0-canary.1

2 years ago

3.1.0-canary

2 years ago

2.1.0

3 years ago

3.0.0

3 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.1.0-beta.1

5 years ago

1.1.0-beta

5 years ago

1.0.0

6 years ago

1.0.0-beta.1

6 years ago

1.0.0-beta

6 years ago

0.2.6

7 years ago

0.2.5

7 years ago

0.2.4

7 years ago

0.2.3

7 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.16

7 years ago

0.0.15

7 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago