Re: [w3c/webcomponents] Need callback for form submit data (#187)

<h3>Implicit submission</h3>

With whatwg/html#4187, manual implicit submission code would be:
```javascript
let form = this.#internals.form;
// form.querySelector(':default') doesn't work due to 'form' content attribute.
for (let control of form.elements) {
  if (control.matches(':default')) {
    if (!control.matches(':disabled'))
      form.requestSubmit(control);
    return;
  }
}
form.requestSubmit();
```

Introducing a flag like ```this.#internals.submitImplicitly = true``` will eliminate the above code.  IMO, it's a nice-to-have feature, and not a mandatory feature for the first version of form-associated custom element.

<h4>:default</h4>

We should be able to make a [submit button](https://html.spec.whatwg.org/multipage/forms.html#concept-submit-button) with form-associated custom element.  I just found a user agent needs to check if a form-associated custom element is a submit button or not to handle the [```:default```](https://html.spec.whatwg.org/multipage/semantics-other.html#selector-default) pseudo class correctly.  We need a flag like ```this.#internals.submitButton = true```.

<h3>Autofocus</h3>

I proposed to move autofocus attribute to HTMLElement.  https://github.com/whatwg/html/issues/4563


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/187#issuecomment-490035174

Received on Tuesday, 7 May 2019 11:10:24 UTC