How can I check whether a browser supports the HTML5 form
attribute on input
elements?
Following this question, I've tried the following:
var supportForm = function()
{
var input = document.createElement("input");
if ("form" in input)
{
input.setAttribute("form", "12345");
if (input.form == "12345")
return true;
}
return false;
}
... but that gives a false negative for FireFox (14, at least). Replacing input.form
with input.getAttribute("form")
gives a false positive for IE 9.