-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1636288 [wpt PR 23467] - Test the sourceText of event handlers, a…
…=testonly Automatic update from web-platform-tests Test the sourceText of event handlers Follows whatwg/html#5514. -- wpt-commits: af188628fbb56cbce2ba5c9ca418b5f465a64063 wpt-pr: 23467
- Loading branch information
1 parent
5b8a195
commit a29ec1f
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
testing/web-platform/tests/html/webappapis/scripting/events/event-handler-sourcetext.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>Test the sourceText of event handlers</title> | ||
<link rel="help" href="https://github.com/whatwg/html/issues/5500"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
|
||
<body> | ||
<script> | ||
"use strict"; | ||
|
||
test(() => { | ||
const el = document.createElement("div"); | ||
el.setAttribute("onclick", "foo"); | ||
assert_equals(el.onclick.toString(), "function onclick(event) {\nfoo\n}"); | ||
}, "non-error event handler"); | ||
|
||
test(() => { | ||
const el = document.createElement("div"); | ||
el.setAttribute("onerror", "foo"); | ||
assert_equals(el.onerror.toString(), "function onerror(event) {\nfoo\n}"); | ||
}, "error event handler not on body"); | ||
|
||
test(() => { | ||
const el = document.createElement("body"); | ||
el.setAttribute("onerror", "foo"); | ||
assert_equals(el.onerror.toString(), "function onerror(event, source, lineno, colno, error) {\nfoo\n}"); | ||
}, "error event handler on disconnected body"); | ||
|
||
test(() => { | ||
const el = document.createElement("frameset"); | ||
el.setAttribute("onerror", "foo"); | ||
assert_equals(el.onerror.toString(), "function onerror(event, source, lineno, colno, error) {\nfoo\n}"); | ||
}, "error event handler on disconnected frameset"); | ||
|
||
test(() => { | ||
document.body.setAttribute("onerror", "foo"); | ||
assert_equals(window.onerror.toString(), "function onerror(event, source, lineno, colno, error) {\nfoo\n}"); | ||
}, "error event handler on connected body, reflected to Window"); | ||
</script> |