Skip to content

autarc/is-pseudo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-standard-style

is Pseudo (?)

Provide a simple lookup to check if a provided selector targets a pseudo class or element.

About

Although there are already some projects which refer towards a list of pseudo classes or elements - they are not convenient to use for a simple lookup. On the contrary this library provides a simple validation function which also include browser vendor specific selectors and common extensions defined by jQuery & CSS Select.

Usage

Install

npm install --save is-pseudo

General

import isPseudo from 'is-pseudo'

if (isPseudo('div a.super:hover')) {
  // true
}

if (isPseudo('div span:has(a)', { customs: true })) {
  // true
}

TODO

  • add strict comparison option for selectors with brackets (e.g. :nth-child(3))

Links

Development

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

About

Validate if a CSS selector targets a pseudo class or element

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published