Created
April 25, 2015 19:34
-
-
Save DigiTec/7171d696519a538d851a to your computer and use it in GitHub Desktop.
And the vendor prefixes attack again. This time, the ordinal indexing of the CSSStyleDeclaration is being used to see what the "first" vendor prefix is within the list of parser names supported by the browser. Since -ms- comes before -webkit- it will prioritize that over anything else. Also, the implicit assumption that if you support one vendor…
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
// Utilize duck typed slice, to enumerate 0..length indices. | |
// Indices on CSSStyleDeclaration return the "parser" names for properties. | |
// Based on the parser names, determine the vendor prefix to use. | |
var vendor_prefix = Array.prototype.slice.call(window.getComputedStyle(document.body)).join('').match(/-(ms|webkit|moz)-/)[0]; | |
console.log(vendor_prefix); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment