New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Pseudo Class Enter Build Status

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

Follow these steps to use Pseudo Class Enter.

Add Pseudo Class 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 Pseudo Class 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 Pseudo Class 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 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

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.

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 11 Sep 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