Skip to content

Commit f627640

Browse files
soosungp33chromium-wpt-export-bot
authored andcommitted
Make srcElement nullable to match DOM spec
This patch updates the srcElement attribute from non-nullable to nullable to match the DOM specification. Since null was already returned regardless of the IDL change, this patch is not an actual behavior change. Bug: 456874035 Change-Id: Ie9bc23c593bbdb83958cb26c955068f3e297b068 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7109378 Commit-Queue: YeongHan Kim <[email protected]> Reviewed-by: Mason Freed <[email protected]> Reviewed-by: Jinho Bang <[email protected]> Cr-Commit-Position: refs/heads/main@{#1542195}
1 parent 6f19749 commit f627640

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<meta charset="UTF-8">
3+
<title>Event srcElement should be nullable</title>
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<body>
7+
<div id="target"></div>
8+
<script>
9+
test(() => {
10+
const event = new Event('test');
11+
assert_equals(event.srcElement, null);
12+
13+
const div = document.getElementById('target');
14+
div.addEventListener('test', e => {
15+
assert_not_equals(e.srcElement, null)
16+
});
17+
div.dispatchEvent(event);
18+
}, 'Event srcElement should be nullable');
19+
</script>
20+
</body>

0 commit comments

Comments
 (0)