Closed cferdinandi closed 6 years ago
var validityObjProperties = ["badInput", "patternMismatch", "rangeOverflow", "rangeUnderflow", "stepMismatch", "tooLong", "tooShort", "typeMismatch", "valid", "valueMissing"]; var supported = function () { var input = document.createElement('input'); if('validity' in input) { var supportObj = { lackSupport: false, unsupportedProps: [] }; for(var i = 0; i < validityObjProperties.length; i++) { var validityProp = validityObjProperties[i]; var isPropSupported = validityProp in input; if(!isPropSupported) { supportObj.lackSupport = true; supportObj.unsupportedProps.push(validityProp); } } } return supportObj; };
Via Konstantin
Changed my mind
Via Konstantin