Simo -
The more I work with what you've done, the more excited I get. Amazing
that this capability was just hiding in plain sight waiting for
someone to work out the details in a designer-friendly fashion.
Beautiful job so far. Keep going and don't let anything get in the
way!
That said, back to avoiding FOUC in IE as gracefully as possible ...
For now - and it's working for IE8 Standards, too - I've taken the
Cufon.now() statement out of the body and into the head along with the
other Cufon related script by adding a script element with a defer
attribute within an IE conditional comment.
Like this:
<!--[if IE]>
<script type="text/javascript" defer="defer">Cufon.now()</script>
<![endif]-->
So far, working like a charm. This is, at least to me, a bit more
elegant than having to split things up and invade the body of every
page.
Now, my understanding is that using a script tag with the defer
attribute is a very common way of creating a DOMContentLoaded event in
IE. And is used within libraries all the time.
Commonly attributed to Dean Edwards, Matthias Miller, and John Resig.
Summed up at:
http://dean.edwards.name/weblog/2006/06/again/
And it looks like this:
// for Internet Explorer (using conditional comments)
/*@cc_on @*//*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/
script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() { if (this.readyState ==
"complete") {
init();
// call the onload handler }};
/*@end @*/
And if this is the case, if someone is using Cufon in conjunction with
a library, it would seem to make sense to call Cufon.now() - if that
fixes the FOUC problem - upon the firing of the DOMready event
provided by the library. (Just a thought - haven't tested.)
(BTW - I might be pointing out something here that you've considered
and discarded for one reason or another - but I have no way of knowing
what you do or don't know. And I'll tell you right now that you're a
better object-oriented coder than me!)
Gotta go and get other stuff done now but I'll be keeping track of
this group carefully.
Thanks again for the great work.
Richard Fink
> >> Richard Fink- Hide quoted text -
>
> - Show quoted text -