
Security News
NVD Concedes Inability to Keep Pace with Surging CVE Disclosures in 2025
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
css-surveyor
Advanced tools
English | 中文
Easily calculate pixel values for CSS length expressions
npm i css-surveyor
import { CssSurveyor } from 'css-surveyor'
const surveyor = new CssSurveyor()
surveyor.widthExpr = '100%'
surveyor.heightExpr = 'calc(100vh - 50px)'
console.log(surveyor.width, surveyor.height)
surveyor.events.on('widthChanged', w => console.log('Width updated to:', w))
surveyor.events.on('heightChanged', h => console.log('Height updated to:', h))
// Call cleanup method to release resources when no longer in use
surveyor.cleanup()
new CssSurveyor(connectTo?: HTMLElement | string | null)
connectTo
: Optional parameter specifying the element to connect to. Subsequent size calculations will be based on this element.
document.querySelector
to find the elementdocument.body
connect
method laterconnect(elemOrSelector?: HTMLElement | string)
: Connect to the specified element. Same as constructor parameter but cannot be nulldisconnect()
: Disconnect from the current elementremeasure()
: Manually trigger remeasurement, usually not needed to call manuallycleanup()
: Call this function when no longer in use. It will disconnect and clear all event listenerswidthExpr?: string
: Get or set the width expressionheightExpr?: string
: Get or set the height expressionwidth: number
: Get the currently measured widthheight: number
: Get the currently measured heightconnected?: HTMLElement
: Get the currently connected elementevents
: Event emitter for subscribing to widthChanged
and heightChanged
events. Refer to mittdiv
element for measurements, which won't affect page layout but may impact :empty
pseudo-class selector resultscleanup()
method when monitoring is no longer needed to release resourceswidthExpr
and heightExpr
expressions because CSS percentage values may reference either width or height. So if the expression you want to calculate doesn't include percentage values, it doesn't matter which one you useFAQs
Easily calculate pixel values for CSS length expressions
The npm package css-surveyor receives a total of 0 weekly downloads. As such, css-surveyor popularity was classified as not popular.
We found that css-surveyor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Security experts warn that recent classification changes obscure the true scope of the NVD backlog as CVE volume hits all-time highs.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.