
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
css-priority
Advanced tools
calculate priority of css selector/rule
We use Array(6)
to store the priority value:
// rank algorithm
// -----------------
// a. important mark
// b. style attribte
// c. ID attribute (size)
// d. attributes + pseudo-class (size)
// e. element + pseudo-element (size)
// f. position of selector
var priority = [a, b, c, d, e, f]
calculate priority of selector (with rule info):
var priority = require('css-priority')
// output: [0, 0, 0, 0, 0, 12]
priority.parse('*', {
line: 12
})
// output: [1, 0, 0, 2, 3, 88]
priority.parse('button.button > i.icon:before', {
important: true,
line: 88
})
Compare selectors:
var priority = require('css-priority')
var selectors = [
'*'
'li'
'li:first-line'
'ul li'
'ul ol + li'
'h1 + *[rel=up]'
'ul ol li.red'
'li.red.level'
]
var cache = {}
selectors.sort(function (a, b) {
var calcA = cache[a] || (cache[a] = priority.parse(a))
var calcB = cache[b] || (cache[b] = priority.parse(b))
return priority.compare(a, b)
})
priority.parse(selector, opts)
parse css selector with rule info, and return Array(6)
of priority
priority.compare(array1, array2)
Compare different priority array
MIT
FAQs
calculate priority of css selector/rule
The npm package css-priority receives a total of 75 weekly downloads. As such, css-priority popularity was classified as not popular.
We found that css-priority 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.