I had a good look at JQuery.rule. I'm sure it's great, but the
complete lack of any credible documentation makes it pretty unusable.
Even the online demo could do with some text explaining what's
actually going on and why, rather than just having some links. After
getting frustrated looking at it, I just wrote my own function
instead:-

function getClassRule(classname,rulename) {
        var retval;
    for ( var i=0; i < document.styleSheets.length; i++ ) {
        var style_sheet = document.styleSheets[i];
        if ( !style_sheet ) { continue; }
        var sheet_rules = style_sheet.cssRules || style_sheet.rules;
        for (var j = 0; j < sheet_rules.length; j++) { // later rules
will overide retval//
            var rule = sheet_rules[j];
                        if ( rule.selectorText ) {
                                var class_name = 
rule.selectorText.replace(/\./g, '');
                                if (class_name == classname) {
                                        if ( rule.style[rulename] ) {
                                                retval = rule.style[rulename];
                                        }
                                        //return rule.style[rulename]; //Class 
may be defined in several
sheets, rules are merged
                                }
                        }
        }
    }
        return retval;
}


Lyle

Reply via email to