-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngPattern): match behaviour of native HTML pattern attribute #9888
Conversation
From https://html.spec.whatwg.org/multipage/forms.html#attr-input-pattern > The compiled pattern regular expression, when matched against a string, must have its start anchored to the start of the string and its end anchored to the end of the string. Closes angular#9881
Do we want breaking changes in 1.3.x? |
personally I don't really care, it was wrong before anyway |
I don't think we should consider it a breaking change, since it won't break peoples applications. |
Well, if an application has a workaround like
but I'd say, rather break it completely than break it in only some cases. |
Nope. There's a test in the tree that does exactly this, it's not broken |
Yes, you're right. Which means |
@petebacondarwin this was supposed to be for the last milestone, guess I forgot to move it there when I wrote this. Can I get you to review since @matsko won't be able to? |
@petebacondarwin are you going to look at this and make a call today? |
Yes this looks correct. Try entering in "ABCa" into the field. http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_pattern It kinda sucks that the form validation API is strict like this. |
I will look in one hour |
LGTM - I am going to add tests that ensure that patterns containing ^ and $ work and then merge. |
Also I will add more documentation explaining the behaviour of |
From https://html.spec.whatwg.org/multipage/forms.html#attr-input-pattern
/CC @matsko please review
Closes #9881