1.1.3 • Published 5 years ago

corleone v1.1.3

Weekly downloads
4
License
Apache
Repository
github
Last release
5 years ago

corleone

Small DOM utilities.

Installation

npm install corleone -S

Usage

import dom from 'corleone'

dom.show(dom.query('.container'))

API

show

Shows a given DOM node.

dom.show(dom.query('.container'))

hide

Hides a given DOM node.

dom.hide(dom.query('.container'))

create

Create a DOM node from a string.

const node = dom.create('<div class="container"></div>')

remove

Removes a given DOM node from the DOM tree.

dom.remove(dom.query('.container'))

query

Alias for document.querySelector. If rootEl is passed, rootEl.querySelector is used.

const containerNode = dom.query('.container', [rootEl])

queryAll

Alias for document.querySelectorAll. If rootEl is passed, rootEl.querySelectorAll is used.

const imgNodes = dom.queryAll('img', [rootEl])

offset

Returns coordinates of element relative to document.

const coords = dom.offset(el)

closest

Returns closest parent that matches selector.

const el = dom.closest(el, '.foo')

matches

Work as an alias for Element.prototype.matches.

const doesMatch = dom.matches(el, '.red')

caiogondim.com  ·  GitHub @caiogondim  ·  Twitter @caio_gondim

1.1.3

5 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago