The main export of this package is expected to run in the browser. It takes a single argument; a string of CSS declarations that are expected to be styling the elements on the page. The return value will be a collection of reported elements which have styles that override the given styles.
Check out the console at the following link: https://ddamato.github.io/css-identify-overrides/examples
- Create a disabled stylesheet from the provided styles.
- Collect all the page stylesheets.
- Get the declarations (rules) from all of the sheets.
- Get unique set of rules; diff the provided rules from the page rules.
- Get the selectors that the provided styles are targeting.
- Get the elements from those selectors and for each of the elements...
- Get the rulesets from the provided stylesheet that match the element.
- Get the rulesets from the page stylesheets; unique rules.
- Provide a reference to the sheet, selector, and offending properties.