Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bubbling submit events and nested forms #756

Open
disnet opened this issue Apr 20, 2019 · 1 comment
Open

Bubbling submit events and nested forms #756

disnet opened this issue Apr 20, 2019 · 1 comment

Comments

@disnet
Copy link

disnet commented Apr 20, 2019

Although nested forms are disallowed, you can still construct a DOM with nested forms dynamically:

let inner = document.createElement('form');
inner.setAttribute('id', 'inner');
let outer = document.createElement('form');
outer.setAttribute('id', 'outer');
outer.appendChild(inner);

document.body.appendChild(outer);

Oddly enough when you do this, a submit event dispatched from the inner form does not bubble up to the outer form.

document.getElementById('outer').addEventListener('submit' e => {
  console.log('never fires for submit events dispatched on inner');
}, false);

This seems to be the case for all modern browsers (but not at least IE 11, I haven't tested earlier IEs).

I would think this behavior should be specified in the event dispatch section of the spec but I can't seem to find anything that would suggest the observed behavior.

Am I just misreading the spec or is this behavior currently unspecified?

@annevk
Copy link
Member

annevk commented Apr 24, 2019

See #687 and whatwg/html#3599 in particular.

I think what mainly needs to happen at this point is writing somewhat exhaustive tests and then patching the dispatch algorithm in whatever way is needed for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants