Created
September 15, 2010 23:53
-
-
Save paulirish/581706 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// quick test for box-shadow support of inset and spread radius | |
// and datauri test | |
// boxshadow test needs other prefixes added. | |
var docElem = document.documentElement; | |
// if WebkitBoxShadow is supported at all then: | |
if (docElem.style.WebkitBoxShadow !== undefined) { /* basic support */ } | |
// first, clear any previous style | |
docElem.style.WebkitBoxShadow = ''; | |
// test spread | |
docElem.style.WebkitBoxShadow = '0px 20px 10px -10px #888'; | |
var isSpreadSupported = docElem.style.WebkitBoxShadow !== ''; | |
docElem.style.WebkitBoxShadow = ''; | |
// test inset | |
docElem.style.WebkitBoxShadow = 'inset 0px 0px 3px #333'; | |
var isInsetSupported = docElem.style.WebkitBoxShadow !== ''; | |
docElem.style.WebkitBoxShadow = ''; | |
console.log('isSpreadSupported: ',isSpreadSupported,' and isInsetSupported: ',isInsetSupported); | |
Modernizr.addTest('datauri',function(){ | |
var data = new Image(); | |
data.onload = data.onerror = function(){ | |
return (this.width == 1 && this.height == 1); | |
} | |
data.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment