Posts by johnhrv

1 post
  • Has been part of the Envato Community for over 3 years
johnhrv says

Hi folks,

Just a quick note to explain more on why older (pre 1.09i) versions of Cufon don’t work correctly with IE9 .

The library depended on legacy, non-standard IE behavior fixed in IE9 . The IE9 behavior is correct (as in, IE9 now behaves like all other browsers) and won’t change so we’ve worked with the Cufon authors on a fix for the library. And as we find sites affected by this, we contact them to let them know there’s an updated version of Cufon to use.

The gory details…

Cufon chooses an “engine” for rendering in registerEngine:
Cufon.registerEngine("vml", (function () {
    if (!document.namespaces) { //<------ browser detection
        return 
    }
   // build engine...
}
The check for document.namespaces is effectively an “if IE” check. IE supports document.namespaces, so the ‘vml’ engine is used instead of the ‘canvas’ engine. IE9 supports VML so that alone isn’t the problem. However, the ‘vml’ engine depends on legacy IE behavior in two places:
  1. Cufon uses elem.unknownAttr = ‘value’ to set a unknown attribute, e.g.
                S.stroked = "f";
                S.coordsize = m;
                S.coordorigin = H = (q - o) + "," + p;
                S.path = (Z.d ? "m" + Z.d + "xe" : "") + "m" + H + e;
                S.fillcolor = a;
    
    Unlike IE8 , IE9 treats these as script expando properties and not content attributes. If you replace these assignments with the standards-based setAttribute(A, B), it will work correctly.
  2. Cufon omits the unit ‘px’ in setting style properties, like ‘width’ and ‘height’. Like other browsers, IE9 requires units on length values without unit.
While this gets the VML engine working in IE9 , the best solution is using the latest-and-greatest: canvas. The canvas engine works great in IE9 .

John Hrvatin Program Manager, Internet Explorer

by
by
by
by
by
by