El jue, 15-03-2007 a las 18:50 +0000, [EMAIL PROTECTED]
escribió:
> Thanks but what I am really trying to do is find out all the attributes that
> define "myClass". Below it appears you have hard-coded certain values, but
> I won't know those ahead of time and there could be different classes per
> element, each defined differently.
>
> Thanks, - Dave
Hi Dave,
I have found your question interesting and i think i have got you a
point from where you can start.
Alltought the code is not jquery at all maybe some jquery hacker finds
it interesenting to develop a small plugin (if i get some time i might
give it a try)
here goes the code:
function getClassContent(classname) {
for (var i=0; i<document.styleSheets.length; i++) {
var styleSheet=document.styleSheets[i];
var ii=0;
var cssRule=false;
do {
if (styleSheet.cssRules) cssRule =
styleSheet.cssRules[ii];
else cssRule = styleSheet.rules[ii];
if (cssRule) {
eval ("regExp = /\."+classname+"/"); // I will
look for
div".classname" in the css
if (regExp.test(cssRule.selectorText))
return cssRule.style.cssText;
}
ii++;
} while (cssRule);
}
}
alert(getStyleAttribute("infoExtra"));
This thing will only work with css rules defined as class (div.myClass),
but not with css rules defined for id (div#myId)... allthought i think
you could make that work not to hardly.
anyway, is this what you were looking for?
--
Javier Infante
Dpto. Internet y Desarrollo
Irontec, Internet y sistemas sobre GNU/Linux - http://www.irontec.com
+34 94 404 81 82 - Ext. 202
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/