Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
computed-style
Advanced tools
Cross-browser currentStyle/getComputedStyle implementation
Weekly downloads
Readme
Cross-browser currentStyle/getComputedStyle implementation
Download one of the available flavors:
bower install computedStyle
npm install computed-style
and component install twolfson/computedStyle
In your web page:
<script src="dist/computedStyle.min.js"></script>
<script>
computedStyle(el, 'color'); // Returns color of the element
</script>
computedStyle
is a single purpose function
computedStyle(element, property);
/**
* Cross-browser getComputedStyle
* @param {HTMLElement} el Element to get property from
* @param {String} prop Property to look up (DOM, zIndex, and CSS, z-index, formats accepted)
* @returns Property from the browser
*
* @note These properties can vary from browser to browser.
* For example, IE6 will return #FF0000 whereas Firefox will return rgb(255, 0, 0)
* I have chosen to avoid this for this repo as it exits the single purpose
* and jQuery follows the same approach.
*/
// Grab the z-index of an element
computedStyle(el, 'z-index');
// Grab the background-color of an element
computedStyle(el, 'background-color');
Support this project and others by twolfson via gratipay.
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint your code using npm run lint
and test via npm test
.
Copyright (c) 2013 Todd Wolfson
Licensed under the MIT license.
FAQs
Cross-browser currentStyle/getComputedStyle implementation
The npm package computed-style receives a total of 158,407 weekly downloads. As such, computed-style popularity was classified as popular.
We found that computed-style 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
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.