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

[whatwg] Proposal: HTMLFormElement#requestAutocomplete() should return a Promise

From: Dan Beam <dbeam@chromium.org>
Date: Mon, 14 Apr 2014 21:41:51 -0700
Message-ID: <CANpe7K3r4qP2_jrOWJATFW=Cyi3E2n4Y5CwH-HAZwZC6pWnCvg@mail.gmail.com>
To: WHATWG <whatwg@whatwg.org>
Cc: bnicholson@mozilla.com, Evan Stade <estade@chromium.org>
Hey whatwg@,

I propose requestAutocomplete()[1] should return a Promise.  This has been
requested since the creation of this API[2][3] and seems like a natural
fit.  Web authors can then call requestAutocomplete() like this:

  form.requestAutocomplete().then(function() {
    // form.submit() or some other success action
  }, function(errorDetails) {
    // handle error based on errorDetails.reason (e.g. "cancel")
  });

The returned promise would be resolved after the corresponding
"autocomplete" or "autocompleteerror" event is dispatched on the form.

Null would be passed on fulfillment* and

  {"reason": <matching AutocompleteErrorEvent#reason>}

would be passed on rejection.

There should be little compatibility risk as requestAutocomplete()
currently returns undefined.

Thoughts?  Concerns?  Questions?

--
Dan Beam
dbeam@chromium.org

* until I think of something useful for the success case...

[1]
http://www.whatwg.org/specs/web-apps/current-work/#dom-form-requestautocomplete
[2]
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/0TnqLOvC2ZY
[3]
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/aqKcZkCMsUI
Received on Tuesday, 15 April 2014 04:42:38 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:28 UTC