
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Handle CSS style functions with no worries.
npm i -S css-func
Examples on how it can be used
const cssfunc = require('css-func');
// get dom element
const element = document.getElementById('#element');
// different ways to specify function parameters
cssfunc(element, 'transform').add('translate', '10px'); // "translate(10px)"
cssfunc(element, 'transform').add('translate', ['10px']); // "translate(10px)"
cssfunc(element, 'transform').add('translate', ['10px', '20px']); // "translate(10px, 20px)"
cssfunc(element, 'transform').add('rotate', '20deg'); // "rotate(20deg)"
console.log(element.style.transform); // "translate(10px, 20px) rotate(20deg)"
Custom variable that holds the cssfunc
instance
const filters = cssfunc(element, 'filter');
filters.add('blur', '10px');
filters.add('grayscale', '100%');
filters.update('blur', '20px');
filters.delete('blur');
filters.exists('blur'); // false
filters.get(); // "grayscale(100%)"
Gets the property from element
cssfunc(element, 'transform').get(); // "translate(10px, 20px) scale(1.1)"
string
Element property valueAdds or updates a function
Name | Type | Description | |
---|---|---|---|
fproperty | string | CSS function name | |
value | string array | CSS function parameters | |
autoUpdate=true | boolean | True to automatically update function if aleady presentTrue to automatically add new function if not present | Optional |
cssfunc(element, 'transform').add('rotate', '10px');
cssfunc(element, 'transform').add('translate', ['10px', '20px']);
cssfunc(element, 'transform').add('translateX', ['10px']);
boolean
True if a function was added or updatedUpdates or adds a function
Name | Type | Description | |
---|---|---|---|
fproperty | string | CSS function name | |
value | string array | CSS function parameters | |
autoAdd=true | boolean | True to automatically add new function if not present | Optional |
cssfunc(element, 'transform').update('rotate');
boolean
True if a function was updated or addedDelete functoin from element style property
Name | Type | Description | |
---|---|---|---|
fproperty | string | CSS function name |
cssfunc(element, 'transform').delete('rotate');
boolean
True if there was a function to deleteReturns true if function exists
Name | Type | Description | |
---|---|---|---|
fproperty | string | CSS function name |
cssfunc(element, 'transform').exists('rotate');
boolean
True if function existsFAQs
Handle CSS style functions with no worries
We found that css-func 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.