Socket
Book a DemoInstallSign in
Socket

corleone

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

corleone

DOM utilities

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
1
Created
Source

corleone

Travis CI

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

FAQs

Package last updated on 07 Jun 2019

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