Skip to content

Instantly share code, notes, and snippets.

@f0urfingeredfish
Last active December 18, 2015 12:58
Show Gist options
  • Save f0urfingeredfish/5786090 to your computer and use it in GitHub Desktop.
Save f0urfingeredfish/5786090 to your computer and use it in GitHub Desktop.
Modernizr.plaintextOnly test for <div contentEditable="plaintext-only">. Currently only works in webkit. see http://stackoverflow.com/questions/10672081/how-to-detect-if-browsr-supports-plaintext-only-value-in-contenteditable-para for more details.
//source
//http://stackoverflow.com/questions/10672081/how-to-detect-if-browser-supports-plaintext-only-value-in-contenteditable-para
Modernizr.addTest('plaintextonly', function(){
var d = document.createElement("div");
try {
d.contentEditable="PLAINtext-onLY";
} catch(e) {
return false;
}
return d.contentEditable=="plaintext-only";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment