An open API service indexing awesome lists of open source software.

https://github.com/eddyerburgh/is-dom-selector

JavaScript function to validate a DOM selector
https://github.com/eddyerburgh/is-dom-selector

Last synced: 6 months ago
JSON representation

JavaScript function to validate a DOM selector

Awesome Lists containing this project

README

          

# is-dom-selector [![CircleCI](https://circleci.com/gh/eddyerburgh/is-dom-selector/tree/master.svg?style=shield)](https://circleci.com/gh/eddyerburgh/is-dom-selector/tree/master)

Returns true if passed a valid DOM selector as a string.

## Usage

```
npm install --save is-dom-selector
```

```js
import isDomSelector from 'is-dom-selector'

isDomSelector('tag') // true
isDomSelector('.class-selector') // true
isDomSelector('#id-selector') // true
isDomSelector('[attribute="value"]') // true
isDomSelector('not $$ valid selector') // false
```