Skip to content

Commit

Permalink
Dispatch selectionchange event per element
Browse files Browse the repository at this point in the history
According to the new spec[1], we need enqueue selectionchange event
per element. WebKit also updated the implementation of selectionchange
event in webcore[2].

[1] w3c/selection-api#172
[2] https://commits.webkit.org/276238@main

Change-Id: If2020febecdf32d6165023712442f16c6e91bd4c
  • Loading branch information
ShuangshuangZhou authored and chromium-wpt-export-bot committed Apr 18, 2024
1 parent 37a0f06 commit bcd98a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions selection/onselectionchange-on-distinct-text-controls.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
assert_equals(selectionChangeCount1, 0);
assert_equals(selectionChangeCount2, 0);
await new Promise(setTimeout);
assert_equals(selectionChangeCount1, 1);
assert_equals(selectionChangeCount1, 2);
assert_equals(selectionChangeCount2, 1);
})();
}, "selectionchange event on each input element fires independently");
Expand All @@ -39,7 +39,7 @@
assert_equals(selectionChangeCount1, 0);
assert_equals(selectionChangeCount2, 0);
await new Promise(setTimeout);
assert_equals(selectionChangeCount1, 1);
assert_equals(selectionChangeCount1, 2);
assert_equals(selectionChangeCount2, 1);
})();
}, "selectionchange event on each textarea element fires independently");
Expand Down
4 changes: 2 additions & 2 deletions selection/textcontrols/selectionchange.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@
target.setRangeText("foo", 2, 6);

await data.assert_empty_spin();
assert_equals(collector.events.length, 1);
assert_equals(collector.events.length, 2);
}, `Calling setRangeText() after select() on ${name}`);

promise_test(async () => {
Expand All @@ -196,7 +196,7 @@
target.setRangeText("", 10, 12);

await data.assert_empty_spin();
assert_equals(collector.events.length, 1);
assert_equals(collector.events.length, 4);
}, `Calling setRangeText() repeatedly on ${name}`);

promise_test(async () => {
Expand Down

0 comments on commit bcd98a5

Please sign in to comment.