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

optimal-select

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

optimal-select

Get efficient & robust CSS selectors for HTML elements

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.2K
decreased by-20.05%
Maintainers
1
Weekly downloads
 
Created
Source

js-standard-style

optimal select

A library which creates efficient and robust CSS selectors for HTML elements.

Features

  • support UMD (Browser + Node)
  • allow single and multiple element inputs
  • configurations for excludes can be defined
  • micro library (~ 5kb + no external dependency)

How To Use

import { select } from 'optimize-select' // global: 'OptimalSelect'

document.addEventListener('click', (e) => {
  var selector = select(e.target)
  console.log(selector)  
})

By default following attributes are excluded for robustness towards changes:

  • style (inline styles often used for dynamic visualizations)
  • data-reactid (reacts element identifier which depends on the current DOM structure)
// pass the attribute as additional parameters (overwrites defaults)
var selector = select(element, { excludes: ['href'] })

TODO

CHANGES

  • 1.0.0: initial release

Development

To build your own version run npm run dev for development (incl. watch) or npm run build for production (minified).

Keywords

FAQs

Package last updated on 10 Dec 2015

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