2

I'm look for a way to search a .css style sheet for a class. The particular class would not have been assigned to any particular DOM element as of yet, it is simple in the style sheet.

I saw another thread which said I could use document.styleSheet, but this requires me to know which order the css file is loaded by the document and also which number the class is defined in the style sheet.

I'm just looking for something like:

var $cssClassHeight = $(document).loadCSS('myClass', 'height');
var $cssClassWidth = $(document).loadCSS('myClass', 'width');

Anything out there like this, or am I going to have to assign it to a dummy div and then read it from it's attributes?

Thanks

Syn

2
  • Do you mean you want to find classes that are never used on th page? Commented Jan 18, 2010 at 12:35
  • Yes, I am looking for class attributes that have never been loaded or assigned, but are defined in the style sheet. Commented Jan 18, 2010 at 12:50

1 Answer 1

1

This jQuery plugin allows you to change the properties of a CSS class, so maybe you could alter it to query them instead.

Sign up to request clarification or add additional context in comments.

2 Comments

Guess I'm going to have to do that then. Thanks
@SynackSA any news about your implementation?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.