MeJsX is beeing developed for common javascript operations
This function is useful when you need to access CSS style rules applied by the author.
- Excludes HTML elements' default CSS properties
- Includes rules from external stylesheets
- Includes rules from internal styles
- Includes rules from
style
attribute - Returns the rules as this order:
- External stylesheets, load order into the document
- Internal styles, written order in the document
- Style attributes on the element
Usage
var element = document.getElementById('idOfElement');
var elementRules = MEJSX.getCustomCssRulesOnElement(element);// elementRules is an array of elementRule
// elementRule has 3 properties:
// elementRule.order => Ordering number of the rule
// elementRule.content => CSS content
// elementRule.media => Media query
Example project on jsFiddle: https://jsfiddle.net/er_han/39g2c838/