I need to check if a CSS rule exists because I want to issue some warnings if a CSS file is not included.
What is the best way of doing this?
I could filter through window.document.styleSheets.cssRules
, but I'm not sure how cross-browser this is (plus I notice on Stack Overflow that object is null for styleSheet[0]
).
I would also like to keep dependencies to a minimum.
Is there a straightforward way to do this? Do I just have to create matching elements and test the effects?
Edit: If not, what are the cross-browser concerns of checking window.document.styleSheets
?
').addClass('css-file-loaded-marker').css('z-index') == -98256` I have no idea how cross browser that really is, do all browsers support z-indicies like that? Do all apply css to a detached element?
– George Mauer Nov 01 '11 at 20:03