mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-05-17 15:11:04 +00:00
31 lines
943 B
JavaScript
31 lines
943 B
JavaScript
/*!
|
|
{
|
|
"name": "Content Editable",
|
|
"property": "contenteditable",
|
|
"caniuse": "contenteditable",
|
|
"notes": [{
|
|
"name": "WHATWG Spec",
|
|
"href": "https://html.spec.whatwg.org/multipage/interaction.html#contenteditable"
|
|
}]
|
|
}
|
|
!*/
|
|
/* DOC
|
|
Detects support for the `contenteditable` attribute of elements, allowing their DOM text contents to be edited directly by the user.
|
|
*/
|
|
define(['Modernizr', 'createElement', 'docElement'], function(Modernizr, createElement, docElement) {
|
|
Modernizr.addTest('contenteditable', function() {
|
|
// early bail out
|
|
if (!('contentEditable' in docElement)) {
|
|
return;
|
|
}
|
|
|
|
// some mobile browsers (android < 3.0, iOS < 5) claim to support
|
|
// contentEditable, but but don't really. This test checks to see
|
|
// confirms whether or not it actually supports it.
|
|
|
|
var div = createElement('div');
|
|
div.contentEditable = true;
|
|
return div.contentEditable === 'true';
|
|
});
|
|
});
|