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

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

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


Received on Tuesday, 15 April 2014 04:42:38 UTC