Přejít k navigační liště

Zdroják » Zprávičky » How to make Modernizr 1.5 work with IE9 Platform Preview

How to make Modernizr 1.5 work with IE9 Platform Preview

Zprávičky ‐ ‐ Různé ‐

Zprávička je dostupná i v češtině.

The well-known HTML5 testing library Modernizr 1.5 doesn’t work correctly in the MSIE9 Platform Preview browser. The reason is a non-standard IE9PP behavior, which isn’t sanitized in the library code.

The Modernizr library tests some properties with a such code:

if (m_style[property] !== undefined) ...

m_style is a shortcut for testing element’s style:

m = doc.createElement( mod ),
m_style = m.style

There are five properties tested in a CSS3 transformation test: ‚transformPro­perty‘, ‚WebkitTransform‘, ‚MozTransform‘, ‚OTransform‘ a ‚msTransform‘. The problem occurs in the IE9PP browser, which correctly returns undefined for the four properties, excepting the last one. Accessing the msTransform property doesn’t return either undefined or an object, but throws a „Not Implemented“ exception. test_props() function in the Modernizr library ver. 1.5 doesn’t catch this exception (nobody expects an exception here), so the whole script fails.

We can hope that next version of the IE9 browser (maybe the public beta) will fix it. Paul Irish, the Modernizr contributor, also reported it as a bug.

We can fix the Modernizr 1.5 library by enclosing the test into a try{} block, and catching the exception. Here is a patched version:

function test_props( props, callback ) {
    for ( var i in props ) {
        try {
          if ( m_style[ props[i] ] !== undefined && ( !callback || callback( props[i], m ) ))
             {return true;}
        } catch (e) { ; }
    }
}

We’ve been noticed about the problem, which affect our HTML5 Support Detector, by Štěpán Bechynský.

Komentáře

Odebírat
Upozornit na
guest
0 Komentářů
Nejstarší
Nejnovější Nejvíce hlasů

Favicon: Jak vznikla nejmenší ikona na webu

Otevřete si v prohlížeči deset záložek a nejspíš je od sebe nebudete rozlišovat podle titulků, ale podle malých obrázků vlevo od nich. Modré F, zelené kolečko, oranžový čtvereček. Favicon je dnes tak samozřejmou součástí webu, že si ho všimneme, až když chybí a na jeho místě svítí šedý glóbus. Přitom vznikl jako vedlejší nápad jednoho vývojáře, prosadil se bez jakéhokoli standardu a ještě pětadvacet let poté nese stopy kompromisů z konce devadesátých let.

Sabotuje Claude Code práci na AI? Malý experiment ukazuje spíš na pomalejší a opatrnějšího agenta

‐ AI ‐
Komentáře: 0
Na sociálních sítích se koncem listopadu rozjela debata o tom, že modely Claude záměrně kazí práci na vývoji jiných AI modelů. Předběžná studie zkusila tvrzení ověřit jednoduchým trikem: stejný úkol, stejný model, jen jiná informace o tom, k čemu bude výsledný kód sloužit. Výsledek je zajímavější, než by napovídal titulek „sabotáž“, ale zároveň méně dramatický.