I am trying to caculate the current style of an element:
function cssIsLoaded(c) {
if (window.getComputedStyle) {
return window.getComputedStyle(c, null).display === "none";
}
else if (c.currentStyle) {
}
return true;
}
(function() {
var cssload = document.createElement("div");
cssload.className = "_css_loaded";
checkLoaded();
function checkLoaded() {
if (!cssIsLoaded(cssload)) setTimeout(function() {
checkLoaded();
}, 20);
else blalbalblbalbalablbal();
}
})();
IE doesnt get into the 2nd condition, c.currentStyle
is null... why is that?
An element doesn't get its
currentStyle
property populated until it's added to the document, which makes some sense: until the element's been added to the document, the browser cannot know which existing style rules will apply to it.