Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
CSS Prefixer for JavaScript code. The simple library to get vendor-prefixed name (e.g. `webkitFlex`) and vendor-prefixed value (e.g. `-moz-inline-grid`) of CSS property. This is not pre-compiler for style-sheet, this is used to handle those in JavaScript
CSS Prefixer for JavaScript code.
The simple library to get vendor-prefixed name (e.g. webkitFlex
) and vendor-prefixed value (e.g. -moz-inline-grid
) of CSS property.
This is not pre-compiler for style-sheet, this is used to handle those in JavaScript code.
Load CSSPrefix into your web page.
<script src="cssprefix.min.js"></script>
CSSPrefix.getName
prefixedName = CSSPrefix.getName(name)
Return a vendor-prefixed name of CSS property, or an original name that doesn't require vendor-prefix. If nothing was found, return an undefined
.
For example:
prefixedName = CSSPrefix.getName('text-emphasis'); // 'textEmphasis' also is accepted
console.log(prefixedName);
// -> "webkitTextEmphasis" on Chrome
// -> "textEmphasis" on Firefox
prefixedName = CSSPrefix.getName('column-count'); // 'columnCount' also is accepted
console.log(prefixedName);
// -> "columnCount" on Chrome
// -> "MozColumnCount" on Firefox
CSSPrefix.getValue
prefixedValue = CSSPrefix.getValue(name, value)
Return a vendor-prefixed value of CSS property, or an original value that doesn't require vendor-prefix. If value
is an Array that includes multiple values, try it with each value until any one of them is found. If nothing was found, return an undefined
.
name
can be an original name even if it requires vendor-prefix.
For example:
prefixedValue = CSSPrefix.getValue('cursor', 'grab');
console.log(prefixedValue);
// -> "-webkit-grab" on Chrome
// -> "grab" on Firefox
prefixedValue = CSSPrefix.getValue('display', ['inline-grid', 'block']);
console.log(prefixedValue);
// -> "block" on Chrome
// -> "-moz-inline-grid" on Firefox
jQuery also can find the vendor-prefixed name. But it can't find the vendor-prefixed value. And your code can't get the vendor-prefixed name that jQuery found.
And jQuery doesn't have cache. That affects performance.
This is older version.
Reported by Benchmark.js.
Test Code:
var elmJq = $('#elm4jquery'),
elmCp = document.getElementById('elm4cssprefix');
// jQuery name
function jqName() {
elmJq.css('column-width', '5px');
elmJq.css('column-width', '10px');
}
// CSSPrefix name
function cpName() {
elmCp.style[CSSPrefix.getName('column-width')] = '5px';
elmCp.style[CSSPrefix.getName('column-width')] = '10px';
}
// jQuery value
function jqValue() {
// jQuery can't find vendor-prefixed value.
elmJq.css('cursor', 'grab,-webkit-grab');
elmJq.css('cursor', 'grabbing,-webkit-grabbing');
}
// CSSPrefix value
function cpValue() {
elmCp.style[CSSPrefix.getName('cursor')] = CSSPrefix.getValue('cursor', 'grab');
elmCp.style[CSSPrefix.getName('cursor')] = CSSPrefix.getValue('cursor', 'grabbing');
}
CSSPrefix.getProp
and CSSPrefix.setValue
were removed, then CSSPrefix.getName
and CSSPrefix.getValue
were added. The CSSPrefix.getValue
doesn't set a value.CSSPrefix.getName
and CSSPrefix.getValue
don't require an element.CSSPrefix.getName
and CSSPrefix.getValue
return undefined
if nothing was found. Older methods returned an empty string but some CSS properties accept empty string, and that couldn't differentiate "accepted empty string" and "value not found".css-prefix.min.js
file also was renamed to cssprefix.min.js
.FAQs
CSS Prefixer for JavaScript code. The simple library to get vendor-prefixed name (e.g. `webkitFlex`) and vendor-prefixed value (e.g. `-moz-inline-grid`) of CSS property. This is not pre-compiler for style-sheet, this is used to handle those in JavaScript
The npm package cssprefix receives a total of 247 weekly downloads. As such, cssprefix popularity was classified as not popular.
We found that cssprefix 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.