W3C home > Mailing lists > Public > whatwg@whatwg.org > April 2017

Re: [whatwg] Adding progress event for native <form>?

From: Anne van Kesteren <annevk@annevk.nl>
Date: Tue, 11 Apr 2017 15:05:42 +0200
Message-ID: <CADnb78h5v6Y0LaNVAAU4h8owDPjVg=yysRbgZMSgqoo=DWvq1w@mail.gmail.com>
To: Mikko Rantalainen <mikko.rantalainen@peda.net>
Cc: whatWG <whatwg@whatwg.org>
On Tue, Apr 11, 2017 at 2:44 PM, Mikko Rantalainen
<mikko.rantalainen@peda.net> wrote:
> I see that https://xhr.spec.whatwg.org/ already defines ProgressEvent
> for XMLHttpRequest.
>
> Would it be possible to add "progress", "load", etc. events to normal
> form elements, too? Basically, I would like to do
>
>   form.addEventListener('progress', function (e) {...})
>
> and if the end user hits the Submit button, my progress listener would
> get called with ProgressEvent with lengthComputable, loaded and total
> attributes.
>
> If I have understood correctly, this does not make any information
> available to JavaScript that is not already available because JavaScript
> *can* already evaluate all form fields, use FileReader API to get all
> the files in file inputs and submit the form to the same action URL
> using XMLHttpRequest. In addition, browsers already implement all the
> required code because XMLHttpRequest needs that behavior.
>
> If listening for "progress" were allowed, I could implement my own form
> submission UI and still use regular forms that would work even without
> JavaScript.

It would leak new information cross-origin and due to redirects that
would be hard to distinguish from same-origin. You'd also have to
submit into some kind of <iframe> as otherwise you end up navigating
anyway.


-- 
https://annevankesteren.nl/
Received on Tuesday, 11 April 2017 13:06:14 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 11 April 2017 13:06:15 UTC