Skip to content

Instantly share code, notes, and snippets.

@bryanforbes
Created November 29, 2012 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanforbes/4169762 to your computer and use it in GitHub Desktop.
Save bryanforbes/4169762 to your computer and use it in GitHub Desktop.
css-user-select
has.add("css-user-select", function(global, doc, element){
var style = element.style;
if(typeof style.userSelect !== "undefined"){
// Unlikely; user-select is non-standard, but might as well be future-proof...
return "userSelect";
}
var prefixes = ["Khtml", "O", "ms", "Moz", "Webkit"],
i = prefixes.length,
prefix, name;
while(prefix = prefixes[--i]){
if(style[(name = prefix + "UserSelect")] !== undefined){
// Supported w/ vendor prefix; return whole name
return name;
}
}
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment