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

postcss-pseudo-class-enter

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-pseudo-class-enter

Use the proposed :enter pseudo-class in CSS

  • 0.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
592
increased by2.6%
Maintainers
1
Weekly downloads
 
Created
Source

PostCSS Pseudo-Class Enter Build Status

PostCSS Pseudo-Class Enter is a PostCSS plugin that allows you to use the proposed :enter pseudo-class in CSS.

:enter simplifies selectors targeting elements that are designated, as the naming of :hover is somewhat misleading; it specifically means elements designated with a pointing device, rather than any device.

/* before */

nav :enter > span {
	background-color: yellow;
}

/* after */

nav :hover > span,
nav :focus > span {
	background-color: yellow;
}

From the proposal:

The :enter pseudo-class applies while the user designates an element with a keyboard, pointing device, or other form of input. It matches an element if the element would match :focus or :hover.

Usage

You just need to follow these two steps to use PostCSS Pseudo-Class Enter:

  1. Add PostCSS to your build tool.
  2. Add PostCSS Pseudo-Class Enter as a PostCSS process.
npm install postcss-pseudo-class-enter --save-dev

Node

postcss([ require('postcss-pseudo-class-enter')({ /* options */ }) ])

Grunt

Install Grunt PostCSS:

npm install postcss-pseudo-class-enter --save-dev

Enable PostCSS Pseudo-Class Enter within your Gruntfile:

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
	postcss: {
		options: {
			processors: [
				require('postcss-pseudo-class-enter')({ /* options */ })
			]
		},
		dist: {
			src: 'css/*.css'
		}
	}
});

Options

prefix (string): prepends a prefix (surrounded by dashes) to the pseudo-class, preventing any clash with native syntax.

{
	prefix: 'foo' // pseudo-class becomes :-foo-enter
}

Alternatives

Below are some other methods to recreate the effects of :enter.

Use @custom-selector (supported nowhere yet)
@custom-selector :--enter :focus, :hover;

:--enter { /* ... */ }
Use :matches (supported in Firefox 4+, Chrome 12+, Opera 15+, Safari 5.1+)
:matches(:focus, :hover) { /* ... */ }
Use :focus and :hover (supported everywhere)
:focus, :hover { /* ... */ }
Use Sass mixins (requires preprocessing)
@mixin -enter { &:focus, &:hover { @content; } }

@include -enter { /* ... */ }

Keywords

FAQs

Package last updated on 16 Jun 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