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

input.parentNode.oninput is never called #9574

Closed
Gozala opened this issue Feb 8, 2016 · 4 comments
Closed

input.parentNode.oninput is never called #9574

Gozala opened this issue Feb 8, 2016 · 4 comments
Assignees
Labels
A-content/dom Interacting with the DOM from web content E-less-complex Straightforward. Recommended for a new contributor.

Comments

@Gozala
Copy link
Contributor

Gozala commented Feb 8, 2016

It looks like input events do not propagate as they are expected. Here is an example that illustrates the issue:

<html>
<body>
<input id='input' type=text />
<pre id='output'></pre>
</body>
<script>
const input = document.querySelector('#input')
const output = document.querySelector('#output')
const body = document.body

const onEvent =
  event =>
  output.textContent += `${event.currentTarget.tagName} : ${event.type} - ${event.key}\n`

body.onkeydown = onEvent
body.onkeypress = onEvent
body.onkeyup = onEvent
body.oninput = onEvent
input.onkeydown = onEvent
input.onkeypress = onEvent
input.onkeyup = onEvent
input.oninput = onEvent
</script>
</html>

Typing s into input should produce following output:

INPUT : keydown - s
BODY : keydown - s
INPUT : keypress - s
BODY : keypress - s
INPUT : input - undefined
BODY : input - undefined
INPUT : keyup - s
BODY : keyup - s

On servo it produces following instead:

INPUT : keydown - s
BODY : keydown - s
INPUT : input - undefined
INPUT : keyup - s
BODY : keyup - s
@Gozala
Copy link
Contributor Author

Gozala commented Feb 8, 2016

/cc @paulrouget

@jdm
Copy link
Member

jdm commented Feb 8, 2016

The radio/checkbox input event bubbles, but the text input event does not.

@jdm jdm added A-content/dom Interacting with the DOM from web content E-less-complex Straightforward. Recommended for a new contributor. labels Feb 8, 2016
@jdm
Copy link
Member

jdm commented Feb 8, 2016

This is a straightforward fix to improve conformance with the specification.

@jdm
Copy link
Member

jdm commented Feb 8, 2016

Unfortunately I don't know that there's a way to write an automated test for this, since the input event should only be dispatched based on explicit user input, per spec: "These events are not fired in response to changes made to the values of form controls by scripts. (This is to make it easier to update the values of form controls in response to the user manipulating the controls, without having to then filter out the script's own changes to avoid an infinite loop.)"

@paulrouget paulrouget self-assigned this Feb 9, 2016
bors-servo pushed a commit that referenced this issue Feb 12, 2016
input event should bubble

No test because: #9574 (comment)

Fix #9574

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9614)
<!-- Reviewable:end -->
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this issue Oct 1, 2019
…EventBubbles); r=mbrubeck

No test because: servo/servo#9574 (comment)

Fix #9574

Source-Repo: https://github.com/servo/servo
Source-Revision: a24e86e76fb2bebc1ded68d17cda10aa10417364

UltraBlame original commit: 65db5bb4b50119dadf367a1e263df60713bceb4d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this issue Oct 1, 2019
…EventBubbles); r=mbrubeck

No test because: servo/servo#9574 (comment)

Fix #9574

Source-Repo: https://github.com/servo/servo
Source-Revision: a24e86e76fb2bebc1ded68d17cda10aa10417364

UltraBlame original commit: 65db5bb4b50119dadf367a1e263df60713bceb4d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this issue Oct 1, 2019
…EventBubbles); r=mbrubeck

No test because: servo/servo#9574 (comment)

Fix #9574

Source-Repo: https://github.com/servo/servo
Source-Revision: a24e86e76fb2bebc1ded68d17cda10aa10417364

UltraBlame original commit: 65db5bb4b50119dadf367a1e263df60713bceb4d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-content/dom Interacting with the DOM from web content E-less-complex Straightforward. Recommended for a new contributor.
Projects
None yet
Development

No branches or pull requests

3 participants