I ran into some very weird behaviour in regards to .hasOwnProperty() and the ValidityState object.
In both IE (11) and FF (26), calling .hasOwnProperty() on ValidityState always returns false, even though the property is definitely set. In Chrome (33.0.1750.154 m) it seems to work fine.
Here's the code I used to test (or check out the JSFiddle).
<input type="text" id="dummy" required />
<ul id="properties"></ul>
var oField = document.getElementById('dummy')
,oList = document.getElementById('properties');
oField.addEventListener('change', function() {
oList.innerHTML = '';
for (var sProperty in oField.validity) {
var oLi = document.createElement("li");
oLi.innerHTML = sProperty + '[hasOwnPropertyValue=' + oField.validity.hasOwnProperty(sProperty).toString() + ']';
oList.appendChild(oLi);
}
});
Am I doing something wrong here or is the browser not handling this correctly? I for one, am stumped!
EDIT: Posted a bugby example... I blame fridays