Ok, I’ve hit a weird problem I can’t crack. Here’s some simple code to replicate:
[code]<html>
<head>
<style>
body {
background-color:#9cf !important;
}
</style>
</head>
<body style=”background-color:#fc9;”>
<script>
alert(document.body.style.backgroundColor);
</script>
</body>
</html>
Now I would expect when I echo the background color, it would echo the one that’s actually being used, but it doesn’t. It only will echo if it’s actually attached to the tag. (ie, if I change the above’s body tag to be just <body>, it gives an empty reply.)
I could, of course, parse the entire CSS to figure out just exactly which background color is applied to an element, but that seems a bit excessive and I’d rather not have to. What’s the best way to deal with this?