Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
normalize-selector
Advanced tools
The normalize-selector npm package is designed to normalize CSS selectors by formatting them into a consistent structure. This can be particularly useful for CSS processing tasks, such as minification, linting, or when implementing CSS-in-JS solutions where consistent selector formatting is crucial. It helps in cleaning up and standardizing selectors by removing unnecessary whitespace, sorting pseudo-classes, and ensuring a uniform structure.
Normalization of CSS Selectors
This feature demonstrates how normalize-selector can take a messy CSS selector string with extra spaces and inconsistent formatting, and normalize it into a clean, standardized format. This is particularly useful for CSS optimization and ensuring consistency across a codebase.
"const normalize = require('normalize-selector');
const normalizedSelector = normalize(' ul > li:first-child ');
console.log(normalizedSelector); // Outputs: 'ul > li:first-child'"
postcss-selector-parser is a parser for CSS selectors that allows for manipulation and stringification of CSS selectors. It provides a more comprehensive API for parsing and manipulating selectors compared to normalize-selector, which focuses solely on normalization.
css-what is a package that parses CSS selectors into an understandable structure (tokens). While it doesn't directly normalize selectors in the same way as normalize-selector, it can be used as part of a toolchain to analyze and potentially reformat selectors.
Normalize CSS selectors.
Examples:
#foo>.bar
-> #foo > .bar
#foo > .bar
-> #foo > .bar
foo[ a = 'b' ]
-> foo[a='b']
Run mocha tests on node.js with:
npm test
or:
node ./test/mocha/node-suite.js
View the browser suite directly on rawgithub
The code and all the documentation are released under the MIT license.
FAQs
Normalize CSS Selectors
The npm package normalize-selector receives a total of 756,845 weekly downloads. As such, normalize-selector popularity was classified as popular.
We found that normalize-selector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.