mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(input): use Chromium's email validation regexp
This change uses the regexp from Chromium/Blink to validate emails, and corrects an error in the validation engine, which previously considered an invalid email to be valid. Additionally, the regexp was invalidating emails with capital letters, however this is not the behaviour recomended in the spec, or implemented in Chromium. Closes #5899 Closes #5924
This commit is contained in:
parent
7cf5544a9f
commit
79e519feda
2 changed files with 3 additions and 2 deletions
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
|
||||
var URL_REGEXP = /^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;
|
||||
var EMAIL_REGEXP = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/;
|
||||
var EMAIL_REGEXP = /^[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\.[a-z0-9-]+)*$/i;
|
||||
var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
|
||||
|
||||
var inputType = {
|
||||
|
|
|
|||
|
|
@ -944,7 +944,8 @@ describe('input', function() {
|
|||
it('should validate email', function() {
|
||||
expect(EMAIL_REGEXP.test('a@b.com')).toBe(true);
|
||||
expect(EMAIL_REGEXP.test('a@b.museum')).toBe(true);
|
||||
expect(EMAIL_REGEXP.test('a@B.c')).toBe(false);
|
||||
expect(EMAIL_REGEXP.test('a@B.c')).toBe(true);
|
||||
expect(EMAIL_REGEXP.test('a@.b.c')).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue