Skip to content

Instantly share code, notes, and snippets.

@bre7
Created June 23, 2018 03:45
Show Gist options
  • Save bre7/d8fe2a3b336db06904a076ce890a5bbb to your computer and use it in GitHub Desktop.
Save bre7/d8fe2a3b336db06904a076ce890a5bbb to your computer and use it in GitHub Desktop.
Javascript vendor prefixer
// Source: Another gist, will update if I can get the link
// Replace # with the first letter of the function
["#","webkit#","moz#","ms#","o#"].reduce(function(p, v) { return window[v + p] || p; }, "#FUNCTION_NAME");
// E.g. requestAnimationFrame (vendor prefix not needed anymore)
["r","webkitR","mozR","msR","oR"].reduce(function(p, v) { return window[v + p] || p; }, "equestAnimationFrame");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment