var inputSupport = "oninput" in document.body || checkEvent(document.body);
/*
The following function tests an element for oninput support in Firefox. Many thanks to
http://blog.danielfriesen.name/2010/02/16/html5-browser-maze-oninput-support/
*/
function checkEvent(el) {
// First check, for if Firefox fixes its issue with el.oninput = function
el.setAttribute("oninput", "return");
if (typeof el.oninput == "function")
return true;
// Second check, because Firefox doesn't map oninput attribute to oninput property
try {
var e = document.createEvent("KeyboardEvent"),
ok = false,
tester = function(e) {
ok = true;
e.preventDefault();
e.stopPropagation();
}
e.initKeyEvent("keypress", true, true, window, false, false, false, false, 0, "e".charCodeAt(0));
document.body.appendChild(el);
el.addEventListener("input", tester, false);
el.focus();
el.dispatchEvent(e);
el.removeEventListener("input", tester, false);
document.body.removeChild(el);
return ok;
} catch(e) {}
}