As per summary the implementation of checkValidity method along with its related simple event "invalid" is required as soon as static validation routine are landed.
Created attachment 35093 [details] Untested, undocumented and unworthy patch
Peter and I discussed the Form::checkValidity() method on #WebKit, it has an optional parameter (unhandledInvalidControls) which can be used for interactive validation tkent is going to work (or is already working) on; see 4.10.15.2. I'd like some feedback and, yes, the comment inside HTMLFormElement.idl is a mistake.:)
Comment on attachment 35093 [details] Untested, undocumented and unworthy patch > diff --git a/WebCore/dom/Document.idl b/WebCore/dom/Document.idl > index 44966cc..116be9f 100644 > --- a/WebCore/dom/Document.idl > +++ b/WebCore/dom/Document.idl > @@ -277,6 +277,7 @@ module core { > attribute [DontEnum] EventListener onscroll; > attribute [DontEnum] EventListener onselect; > attribute [DontEnum] EventListener onsubmit; > + attribute [DontEnum] EventListener oninvalid; Alphabetical order? > diff --git a/WebCore/dom/Element.idl b/WebCore/dom/Element.idl > index 16aac84..44a73ae 100644 > --- a/WebCore/dom/Element.idl > +++ b/WebCore/dom/Element.idl > @@ -162,6 +162,7 @@ module core { > attribute [DontEnum] EventListener onscroll; > attribute [DontEnum] EventListener onselect; > attribute [DontEnum] EventListener onsubmit; > + attribute [DontEnum] EventListener oninvalid; Here too > diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h > index a557f94..2276c0f 100644 > --- a/WebCore/dom/Node.h > +++ b/WebCore/dom/Node.h > @@ -613,6 +613,8 @@ public: > void setOnselect(PassRefPtr<EventListener>); > EventListener* onsubmit() const; > void setOnsubmit(PassRefPtr<EventListener>); > + EventListener* oninvalid() const; > + void setOninvalid(PassRefPtr<EventListener>); Here too (maybe should put the existing cases in order...?) > diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl > index 7c61523..e9c6ac5 100644 > --- a/WebCore/page/DOMWindow.idl > +++ b/WebCore/page/DOMWindow.idl > @@ -250,6 +250,7 @@ module window { > attribute EventListener onunload; > attribute EventListener onvolumechange; > attribute EventListener onwaiting; > + attribute EventListener oninvalid; Here too
(In reply to comment #2) > Peter and I discussed the Form::checkValidity() method on #WebKit, it has an > optional parameter (unhandledInvalidControls) which can be used for interactive > validation tkent is going to work (or is already working) on; see 4.10.15.2. It seems good. Thanks!
CC'ed Darin to have his comments too.
Created attachment 35152 [details] Patch v1
Comment on attachment 35152 [details] Patch v1 Regression on (the usual) domListEnumeration: updating...
Created attachment 35157 [details] Patch v1 with updated layout tests
There's a mistake in one of the attached tests.
Created attachment 38398 [details] Patch v1 with working test case
Created attachment 38400 [details] Patch v1a Bugzilla-tool didn't do the trick...:)
Adele gave her feedbacks on irc, the patch is being modified with the elimination of the stuff related to unhandledInvalidControls; instead of it a "TODO" comment is added to remind about it.
Created attachment 38408 [details] Patch v1b This patch complies with Adele's review comments.
Comment on attachment 38408 [details] Patch v1b You can return false early if !control->checkValidity(). Everything else looks good. r=me > +bool HTMLFormElement::checkValidity() > +{ > + // TODO: Check for unhandled invalid controls, see #27452 for tips. > + > + bool hasOnlyValidControls = true; > + for (unsigned i = 0; i < formElements.size(); ++i) { > + HTMLFormControlElement* control = formElements[i]; > + if (!control->checkValidity()) > + hasOnlyValidControls = false; > + } > + > + return hasOnlyValidControls; > +} > +
(In reply to comment #14) > (From update of attachment 38408 [details]) > You can return false early if !control->checkValidity(). Everything else looks > good. r=me I can't. Form::checkValidity() is supposed to fire an invalid event on every single invalid controls it has.
nevermind my comment - I forgot about where the events were dispatched
Fixed in r47649.