blob: 2d5793fe8fed070310adf58e3d312a2609c60663 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<!DOCTYPE html>
<html>
<head>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<script>
SimpleTest.waitForExplicitFinish();
function runTest() {
const summary = document.querySelector("summary");
summary.addEventListener('click', function(e) {
// Prevent the details from toggling by key events.
e.preventDefault();
});
// Dispatch 'return' key to the summary element.
summary.focus();
synthesizeKey("KEY_Enter");
const details = document.querySelector("details");
ok(!details.open, "Prevent default on summary should not open details.");
SimpleTest.finish();
}
</script>
</head>
<body onload="runTest();">
<details>
<summary>Summary</summary>
<p>This is the details.</p>
</details>
</body>
</html>
|