Obviously in JavaScript, we can look up all the CSS rules for the entire document by doing the follow:
- document.styleSheets[0].rules || document.styleSheets[0].cssRules;
Is there anyway to get a CSS Link element from the header of the document and the only the rules for that element?
The
<link>element has asheetproperty which does exactly that:Of course, this is subject to Same Origin Policy