-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(ngForm): 2513 ngForm triggers click/submit events like normal form #6704
Conversation
Thanks for the PR! Please check the items below to help us merge this faster. See the contributing docs for more information.
If you need to make changes to your pull request, you can update the commit with Thanks again for your help! |
@@ -411,6 +411,67 @@ var formDirectiveFactory = function(isNgForm) { | |||
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards | |||
}); | |||
} | |||
|
|||
if (isNgForm) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is a mess here, can you fix this? 2 space soft-tabs
Sorry, WS8 EAP has some issues :) Fixing... |
@@ -411,6 +411,67 @@ var formDirectiveFactory = function(isNgForm) { | |||
extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards | |||
}); | |||
} | |||
|
|||
if (isNgForm) { | |||
var inputs = formElement.find('input'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
button
elements can also trigger submission, among other things. http://www.whatwg.org/specs/web-apps/current-work/multipage/forms.html#category-submit
So, this is a lot of code, and that is maybe not very good. There are problems, like not dealing with dynamically added controls, not dealing with other ways to submit a form, etc. If there are nested ngForms (one of the reasons people use them at all), it will add multiple event handlers to each child control, etc etc... Beyond that, it also really needs a test case (actually, a number of test cases, because this is not a simple feature). So, there's a lot more to do here, this is unfortunately not a low-hanging fruit kind of bug =( |
I'm sorry, but I wasn't able to verify your Contributor License Agreement (CLA) signature. CLA signature is required for any code contributions to AngularJS. Please sign our CLA and ensure that the CLA signature email address and the email address in this PR's commits match. If you signed the CLA as a corporation, please let us know the company's name. Thanks a bunch! PS: If you signed the CLA in the past then most likely the email addresses don't match. Please sign the CLA again or update the email address in the commit of this PR. |
CLA signature verified! Thank you! Someone from the team will now triage your PR and it will be processed based on the determined priority (doc updates and fixes with tests are prioritized over other changes). |
Hi, Thanks for your PR though! |
Fix for issue #2513