Created
May 8, 2012 15:08
-
-
Save farmdawgnation/2636061 to your computer and use it in GitHub Desktop.
Modernizr Test for VML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a Modernizr check for VML | |
Modernizr.addTest('vml', function() { | |
// Adapted from http://stackoverflow.com/questions/654112/how-do-you-detect-support-for-vml-or-svg-in-a-browser | |
var a = document.body.appendChild(document.createElement('div')); | |
a.innerHTML = '<v:shape id="vml_flag1" adj="1" />'; | |
var b = a.firstChild; | |
b.style.behavior = "url(#default#VML)"; | |
var supportsVml = b ? typeof b.adj == "object": true; | |
a.parentNode.removeChild(a); | |
return supportsVml; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can't use document.body inside Modernizr tests - there's a better way to do this. Please see http://www.paulirish.com/2011/surefire-dom-element-insertion/
Instead of:
You should do this: