<!DOCTYPE html>
<!--
Copyright 2016 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Browsing: preventDefault() tests</title>
<script>
function printDone() {
document.getElementById("msg-container").innerText = "Click done";
}
</script>
</head>
<body>
<table>
<tr>
<th>Code</th>
<th>Expected result</th>
</tr>
<tr>
<td>
<a id="overrides-target-blank"
href="about:blank"
target="_blank"
onclick="event.preventDefault();printDone();">
Prevent Default Overrides Target Blank
</a>
<div class="snippet"></div>
</td>
<td>
preventDefault() should override href and target="_blank"
</td>
</tr>
<tr>
<td>
<a id="overrides-stop-propagation"
href="about:blank"
target="_blank"
onclick="event.preventDefault();event.stopPropagation();printDone();">
Prevent Default Overrides Stop Propagation
</a>
<div class="snippet"></div>
</td>
<td>preventDefault() should opverride event.stopPropagation()</td>
</tr>
<tr>
<td>
<a id="overrides-window-open"
href="about:blank"
target="_blank"
onclick="event.preventDefault();
window.location.href='about:blank';
event.stopPropagation();">
Prevent Default Overrides Window Open
</a>
<div class="snippet"></div>
</td>
<td>preventDefault() should override window.open</td>
</tr>
</table>
<div id="msg-container"></div>
</body>
</html>