Skip to content

Commit f2f0130

Browse files
Remove inDocument check for emitting change events
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}
1 parent 1da9889 commit f2f0130

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
6+
<script>
7+
async_test(t => {
8+
const input = document.createElement('input');
9+
input.type = 'checkbox';
10+
input.addEventListener('change', t.step_func_done(() => {}));
11+
input.dispatchEvent(new MouseEvent('click'));
12+
}, 'This test will pass if <input type=checkbox> emits change events while detached from document.body');
13+
</script>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<link rel="author" title="Joey Arhar" href="mailto:jarhar@chromium.org">
3+
<script src="/resources/testharness.js"></script>
4+
<script src="/resources/testharnessreport.js"></script>
5+
6+
<script>
7+
async_test(t => {
8+
const input = document.createElement('input');
9+
input.type = 'radio';
10+
input.addEventListener('change', t.step_func_done(() => {}));
11+
input.dispatchEvent(new MouseEvent('click'));
12+
}, 'This test will pass if <input type=radio> emits change events while detached from document.body');
13+
</script>

0 commit comments

Comments
 (0)