Created
August 13, 2010 23:13
-
-
Save paulirish/523692 to your computer and use it in GitHub Desktop.
Revisions
-
paulirish revised this gist
May 22, 2011 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -7,14 +7,17 @@ function gimmePrefix(prop){ var prefixes = ['Moz','Khtml','Webkit','O','ms'], elem = document.createElement('div'), upper = prop.charAt(0).toUpperCase() + prop.slice(1); if (prop in elem.style) return prop; for (var len = prefixes.length; len--; ){ if ((prefixes[len] + upper) in elem.style) return (prefixes[len] + upper); } return false; } // btw this is available as Modernizr.prefixed(prop) now. -
paulirish revised this gist
Jan 2, 2011 . 1 changed file with 2 additions and 6 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,12 +9,8 @@ function gimmePrefix(prop){ upper = prop.charAt(0).toUpperCase() + prop.slice(1); for (var len = prefixes.length; len--; ){ if ((prefixes[len] + upper) in elem.style) return (prefixes[len] + upper); } if (prop in elem.style) -
paulirish revised this gist
Aug 13, 2010 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ // find out what prefix this browser supports. // usage: gimmePrefix('transform') // 'WebkitTransform' // returns false if unsupported. @@ -9,9 +9,12 @@ function gimmePrefix(prop){ upper = prop.charAt(0).toUpperCase() + prop.slice(1); for (var len = prefixes.length; len--; ){ try { // i hate you ie9 pp4 if ((prefixes[len] + upper) in elem.style) return (prefixes[len] + upper); } catch(e) { continue; } } if (prop in elem.style) -
paulirish created this gist
Aug 13, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ // find out what vendor prefix this browser supports. // usage: gimmePrefix('transform') // 'WebkitTransform' // returns false if unsupported. function gimmePrefix(prop){ var prefixes = ['Moz','Khtml','Webkit','O','ms'], elem = document.createElement('div'), upper = prop.charAt(0).toUpperCase() + prop.slice(1); for (var len = prefixes.length; len--; ){ console.log((prefixes[len] + upper)) if ((prefixes[len] + upper) in elem.style) return (prefixes[len] + upper); } if (prop in elem.style) return prop; return false; }