Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
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
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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.