You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<scriptsrc="dist/computedStyle.min.js"></script><script>computedStyle(el,'color');// Returns color of the element</script>
Documentation
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. */
Examples
// Grab the z-index of an elementcomputedStyle(el,'z-index');// Grab the background-color of an elementcomputedStyle(el,'background-color');
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.