blob: 8e60cdd81c43172335e10f599041d12e944f0aab [file] [log] [blame]
<!DOCTYPE html>
<!-- Copyright 2016 The Chromium Authors. All rights reserved.
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 id="_webScenarioBrowsingLinkPreventDefaultOverridesHref">
<td>
<a id="webScenarioBrowsingLinkPreventDefaultOverridesHref"
href="about:blank"
onclick="event.preventDefault();printDone();">
webScenarioBrowsingLinkPreventDefaultOverridesHref
</a>
</td>
<td>preventDefault() should override href</td>
</tr>
<tr id="_webScenarioBrowsingLinkPreventDefaultOverridesTargetBlank">
<td>
<a id="webScenarioBrowsingLinkPreventDefaultOverridesTargetBlank"
href="about:blank"
target="_blank"
onclick="event.preventDefault();printDone();">
webScenarioBrowsingLinkPreventDefaultOverridesTargetBlank
</a>
<div class="snippet"></div>
</td>
<td>
preventDefault() should override href and target="_blank"
</td>
</tr>
<tr id="_webScenarioBrowsingLinkPreventDefaultOverridesStopPropagation">
<td>
<a id="webScenarioBrowsingLinkPreventDefaultOverridesStopPropagation"
href="about:blank"
target="_blank"
onclick="event.preventDefault();event.stopPropagation();printDone();">
webScenarioBrowsingLinkPreventDefaultOverridesStopPropagation
</a>
<div class="snippet"></div>
</td>
<td>preventDefault() should opverride event.stopPropagation()</td>
</tr>
<tr id="_webScenarioBrowsingLinkPreventDefaultOverridesWindowOpen">
<td>
<a id="webScenarioBrowsingLinkPreventDefaultOverridesWindowOpen"
href="about:blank"
target="_blank"
onclick="event.preventDefault();
window.location.href='about:blank';
event.stopPropagation();printDone();">
webScenarioBrowsingLinkPreventDefaultOverridesWindowOpen
</a>
<div class="snippet"></div>
</td>
<td>preventDefault() should override window.open</td>
</tr>
</table>
<div id="msg-container"></div>
</body>
</html>