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

  • 3.0.1
  • Source
  • npm
  • Socket score

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

:enter PostCSS Logo

NPM Version Build Status Licensing Changelog Gitter Chat

:enter lets you 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.

Options

prefix

Type: String
Default: -

Adds the prefix surrounded by dashes before the pseudo-class.

outline

Type: String
Default: unset

Adds an outline declaration to matching rules when an existing one does not already exist.

Usage

Follow these steps to use :enter.

Add :enter to your build tool:

npm install postcss-pseudo-class-enter --save-dev
Node
require('postcss-pseudo-class-enter')({ /* options */ }).process(YOUR_CSS);
PostCSS

Add PostCSS to your build tool:

npm install postcss --save-dev

Load :enter as a PostCSS plugin:

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

Add Gulp PostCSS to your build tool:

npm install gulp-postcss --save-dev

Enable :enter within your Gulpfile:

var postcss = require('gulp-postcss');

gulp.task('css', function () {
    return gulp.src('./css/src/*.css').pipe(
        postcss([
            require('postcss-pseudo-class-enter')({ /* options */ })
        ])
    ).pipe(
        gulp.dest('./css')
    );
});
Grunt

Add Grunt PostCSS to your build tool:

npm install grunt-postcss --save-dev

Enable :enter within your Gruntfile:

grunt.loadNpmTasks('grunt-postcss');

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

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 14 Dec 2016

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