Skip to content

Commit

Permalink
Remove inDocument check for emitting change events
Browse files Browse the repository at this point in the history
The html spec does not seem to say anything against emitting change
events for input elements which are detached from the DOM. It does say
that immutable input elements should not have change events emitted for
them, but I don't think that having it detached from the DOM means that
it is immutable, especially since we can successfully change the
.checked value while detached from the dom.

Bug: 773680
Change-Id: Ie579ed1f3c34fc03f74554a5685f40c510805f2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1885093
Reviewed-by: Kent Tamura <tkent@chromium.org>
Reviewed-by: Mason Freed <masonfreed@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710642}
  • Loading branch information
josepharhar authored and chromium-wpt-export-bot committed Oct 30, 2019
1 parent 1da9889 commit f2f0130
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>
async_test(t => {
const input = document.createElement('input');
input.type = 'checkbox';
input.addEventListener('change', t.step_func_done(() => {}));
input.dispatchEvent(new MouseEvent('click'));
}, 'This test will pass if <input type=checkbox> emits change events while detached from document.body');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<script>
async_test(t => {
const input = document.createElement('input');
input.type = 'radio';
input.addEventListener('change', t.step_func_done(() => {}));
input.dispatchEvent(new MouseEvent('click'));
}, 'This test will pass if <input type=radio> emits change events while detached from document.body');
</script>

0 comments on commit f2f0130

Please sign in to comment.