Last Comment Bug 556013 - Implement novalidate attribute for form elements
: Implement novalidate attribute for form elements
Status: RESOLVED FIXED
: dev-doc-complete, html5
Product: Core
Classification: Components
Component: DOM: Core & HTML (show other bugs)
: Trunk
: All All
: -- normal with 1 vote (vote)
: mozilla2.0b7
Assigned To: Mounir Lamouri (:mounir)
:
Mentors:
http://dev.w3.org/html5/spec/forms.ht...
: 609033 (view as bug list)
Depends on: 561636
Blocks: html5forms 555728 566348
  Show dependency treegraph
 
Reported: 2010-03-30 09:46 PDT by Mounir Lamouri (:mounir)
Modified: 2010-11-07 03:22 PST (History)
12 users (show)
mounir: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
beta7+


Attachments
Patch v1 (12.49 KB, patch)
2010-09-08 15:09 PDT, Mounir Lamouri (:mounir)
no flags Details | Diff | Splinter Review
Patch v1.1 (13.17 KB, patch)
2010-09-08 18:07 PDT, Mounir Lamouri (:mounir)
bugs: review+
Details | Diff | Splinter Review
Patch v1.2 (13.18 KB, patch)
2010-09-09 11:29 PDT, Mounir Lamouri (:mounir)
no flags Details | Diff | Splinter Review

Description Mounir Lamouri (:mounir) 2010-03-30 09:46:11 PDT
If the novalidate attribute is present, the form has not to be validate when submitted.
Comment 1 Mounir Lamouri (:mounir) 2010-08-22 20:00:39 PDT
We can't ship Firefox 4 with form validation and without this attribute.
Comment 2 Jonas Sicking (:sicking) No longer reading bugmail consistently 2010-08-23 02:09:32 PDT
I'd say that this isn't a new feature but rather finishing up the whole validation thing. And it should be a safe patch as long as we get it in early enough.
Comment 3 Mounir Lamouri (:mounir) 2010-09-08 15:09:17 PDT
Created attachment 473245 [details] [diff] [review]
Patch v1
Comment 4 Mounir Lamouri (:mounir) 2010-09-08 18:07:32 PDT
Created attachment 473328 [details] [diff] [review]
Patch v1.1

The assert was wrong and I've added some tests.
Comment 5 Olli Pettay [:smaug] (vacation Aug 25-28) 2010-09-08 22:54:22 PDT
Comment on attachment 473328 [details] [diff] [review]
Patch v1.1

I'd put HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) to
CheckValidFormSubmission().
Or is there a reason not to?
Comment 6 Mounir Lamouri (:mounir) 2010-09-08 22:59:45 PDT
(In reply to comment #5)
> Comment on attachment 473328 [details] [diff] [review]
> Patch Part2 v1.1
> 
> I'd put HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) to
> CheckValidFormSubmission().
> Or is there a reason not to?

Yes, we will have to check for formnovalidate on the submit control and  CheckValidFormSubmission() can't check that for us. So, better to have novalidate and formnovalidate checks at the same place.
I hate doing that but the base is already quite awful and we can't reasonably refactor the current code so close from releasing and without a good test coverage :-/
Comment 7 Olli Pettay [:smaug] (vacation Aug 25-28) 2010-09-08 23:12:25 PDT
Comment on attachment 473328 [details] [diff] [review]
Patch v1.1


>+document.forms[0].addEventListener("submit", function(aEvent) {
>+  aEvent.target.removeAttribute("submit", arguments.callee, false);
removeAttribute? Also elsewhere.
Comment 8 Jonas Sicking (:sicking) No longer reading bugmail consistently 2010-09-08 23:27:42 PDT
Shouldn't there be checks for the formnovalidate attribute somewhere? Or am I missing something?
Comment 9 Mounir Lamouri (:mounir) 2010-09-08 23:31:05 PDT
(In reply to comment #8)
> Shouldn't there be checks for the formnovalidate attribute somewhere? Or am I
> missing something?

bug 589696(In reply to comment #7)

> Comment on attachment 473328 [details] [diff] [review]
> Patch Part2 v1.1
> 
> 
> >+document.forms[0].addEventListener("submit", function(aEvent) {
> >+  aEvent.target.removeAttribute("submit", arguments.callee, false);
> removeAttribute? Also elsewhere.

oooups :)
Comment 10 Mounir Lamouri (:mounir) 2010-09-09 11:29:10 PDT
Created attachment 473633 [details] [diff] [review]
Patch v1.2

r=smaug

Tests fixed.
Comment 11 Mounir Lamouri (:mounir) 2010-09-10 23:24:54 PDT
Pushed:
http://hg.mozilla.org/mozilla-central/rev/8235bdf7c65e
Comment 13 Mounir Lamouri (:mounir) 2010-11-07 03:22:15 PST
*** Bug 609033 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.