Skip to content

Instantly share code, notes, and snippets.

@DigiTec
Created April 14, 2015 18:04
Show Gist options
  • Save DigiTec/e44a23a7d6781060997e to your computer and use it in GitHub Desktop.
Save DigiTec/e44a23a7d6781060997e to your computer and use it in GitHub Desktop.
Ever wonder why browser vendors dis-like bad feature detection (in this case I'd argue this is browser detection)? Well this is why. Vendor prefix sniffing that ends up assuming support of one vendor prefix means all properties are implemented that way. First, nearly all of the vendor prefixed properties appear very late in the enumeration, so y…
<script>
var r = {};
r.VENDOR_PREFIX = function () {
var e = /^(Webkit|Khtml|Moz|ms|O)(?=[A-Z])/, t = document.getElementsByTagName("script")[0].style, n;
for (n in t)
if (e.test(n))
return n.match(e)[0].toLowerCase();
return "WebkitOpacity" in t ? "webkit" : "KhtmlOpacity" in t ? "khtml" : "";
}();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment