For about as long as I can remember, I've used this to test for contenteditable support:
var ceSupport = false;
if (!navigator.userAgent.match(/iPhone OS [432]/))
ceSupport = 'contentEditable' in document.documentElement;
if (ceSupport) {
// do contenteditable stuff
}
It's my understanding that if the Object key of document.documentElement.contentEditable exists then it's supported, except that iPhone 4 and earlier might throw false positives so I manually excluded them from the list.
But now iPhone 4 and earlier are all but gone, and I'm not even sure that mobile providers would still support them. They might exist for people that only use WiFi, I guess?
Do you think it's safe to just test for document.documentElement.contentEditable now?
[code]if ('contentEditable' in document.documentElement) {
// do contenteditable stuff
}
Is there a better way to test for support? I'm mainly thinking about the future, when the next latest and greatest browser stops supporting it for some ridiculous reason.