-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See whatwg/dom#625 for details.
- Loading branch information
Showing
9 changed files
with
156 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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,64 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Event.returnValue</title> | ||
<link rel="author" title="Chris Rebert" href="http://chrisrebert.com"> | ||
<link rel="help" href="https://dom.spec.whatwg.org/#dom-event-returnvalue"> | ||
<meta name="flags" content="dom"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<div id="log"></div> | ||
<script> | ||
test(function() { | ||
var ev = new Event("foo"); | ||
assert_true(ev.returnValue, "returnValue"); | ||
}, "When an event is created, returnValue should be initialized to true."); | ||
test(function() { | ||
var ev = new Event("foo", {"cancelable": false}); | ||
assert_false(ev.cancelable, "cancelable (before)"); | ||
ev.preventDefault(); | ||
assert_false(ev.cancelable, "cancelable (after)"); | ||
assert_true(ev.returnValue, "returnValue"); | ||
}, "preventDefault() should not change returnValue if cancelable is false."); | ||
test(function() { | ||
var ev = new Event("foo", {"cancelable": false}); | ||
assert_false(ev.cancelable, "cancelable (before)"); | ||
ev.returnValue = false; | ||
assert_false(ev.cancelable, "cancelable (after)"); | ||
assert_true(ev.returnValue, "returnValue"); | ||
}, "returnValue=false should have no effect if cancelable is false."); | ||
test(function() { | ||
var ev = new Event("foo", {"cancelable": true}); | ||
assert_true(ev.cancelable, "cancelable (before)"); | ||
ev.preventDefault(); | ||
assert_true(ev.cancelable, "cancelable (after)"); | ||
assert_false(ev.returnValue, "returnValue"); | ||
}, "preventDefault() should change returnValue if cancelable is true."); | ||
test(function() { | ||
var ev = new Event("foo", {"cancelable": true}); | ||
assert_true(ev.cancelable, "cancelable (before)"); | ||
ev.returnValue = false; | ||
assert_true(ev.cancelable, "cancelable (after)"); | ||
assert_false(ev.returnValue, "returnValue"); | ||
}, "returnValue should change returnValue if cancelable is true."); | ||
test(function() { | ||
var ev = document.createEvent("Event"); | ||
ev.returnValue = false; | ||
ev.initEvent("foo", true, true); | ||
assert_true(ev.bubbles, "bubbles"); | ||
assert_true(ev.cancelable, "cancelable"); | ||
assert_true(ev.returnValue, "returnValue"); | ||
}, "initEvent should unset returnValue."); | ||
test(function() { | ||
var ev = new Event("foo"); | ||
ev.preventDefault(); | ||
ev.returnValue = true;// no-op | ||
assert_true(ev.defaultPrevented); | ||
assert_false(ev.returnValue); | ||
}, "returnValue=true should have no effect once the canceled flag was set."); | ||
</script> | ||
</body> | ||
</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
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