input type="number" is valid when a non numeric value is entered in IE 11
When entering text or a combination of text and numbers, form.number.$valid" does not always validate to false.
Examples: "ddd" validates to true (not OK) "ddd3" validates to true (not OK) "3ddd" validates to false "33" validates to true
When using the required attribute, it works as expected.
Tested OK in Chrome and Firefox 28.0
Plnkr: http://plnkr.co/edit/uqOkCPxNYQWg8xog1IKi?p=preview
Looks like it is a similar issue to #2144
I can look into this later today (but if you can debug this, I would suggest looking at this glob of text, this is probably where the problem is)
It seems to enter the if statement from the glob in both Chrome and IE, but the ValidityState object is different in IE. I don't know if this helps at all...
Chrome ValidityState badInput: true valid: false
IE 11 ValidityState badInput: false valid: true
If you're entering letters in a number input, and IE is not setting badInput to true, then they're not behaving consistently with the spec (for better or worse, some of the things in that spec are kind of nonsense). But even so, the regexp should be invalidating it.
My bad @ badInput, I was testing this inside an ng-grid and got slightly different results there, outside the grid badInput is undefined. Same behavior still though.
I can confirm that this is happening.
Unfortunate as it is, I don't think there's much we can really do about it. IE is not doing the right thing here. All we see is the empty string, and we get no way to know that the string is empty due to an error. That's too bad.
On Thu, Apr 10, 2014 at 9:17 AM, brik [email protected] wrote:
My bad @ badInput, I was testing this inside an ng-grid and got slightly different results there, outside the grid badInput is undefined. Same behavior still though.
Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/7070#issuecomment-40078139 .
Ok, that's a shame. Thanks for looking into it anyway.
I don't think this is really fixable on Angular's side, but I have raised an issue about this with MS at https://connect.microsoft.com/IE/feedback/details/850187/html5-constraint-validation-is-broken-in-ie11-for-input-type-number --- If people +1 it, maybe that could be fixed for the next iteration. I don't know.
I will leave this issue open and possibly revisit it later
Tracked in https://github.com/angular/angular.js/issues/10981 with more info