New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

css-shorthand-lookup

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-shorthand-lookup

A small CSS shorthand property lookup library for CSS parsing and CSSOM traversal

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

CSS Shorthand Lookup

Lookup function for CSS shorthand properties.

Useful in CSS parsing and CSSOM traversal, can be used to circumvent the way all modern browsers treat shorthand properties if CSS Variables are used.

Install

npm i css-shorthand-lookup

Use

Simple lookup

import {lookupShorthands} from 'css-shorthand-lookup';

// Will print ['border-color', 'border-bottom']
console.log(lookupShorthands('border-bottom-color'));

With a CSSStyleRule provided

Assuming the page has the following stylesheet:

.class {
	border: 1px solid var(--border-color);
}

Assuming rule variable holds a reference to the first rule of that stylesheet:

import {lookupShorthands} from 'css-shorthand-lookup';

// Will print ['border']
console.log(lookupShorthands('border-bottom-color', rule));

lookupShorthands can return multiple values if there are several CSS shorthand properties that include the provided property.

If you pass the second CSSStyleRule argument, lookupShorthands will filter out those properties that exist in that rule and will sort them in the order they originally exist in the CSS source.

Keywords

FAQs

Package last updated on 12 Aug 2021

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