37 lines
1.1 KiB
HTML
37 lines
1.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<title>Callback Function Objects Implementing handleEvent()</title>
|
|
</head>
|
|
<body>
|
|
|
|
<p>
|
|
When a JS callback is a function, it should be called. If the function has another function as
|
|
its <code>handleEvent</code> property, that function should <em>not</em> be called.
|
|
</p>
|
|
|
|
<p id="console"></p>
|
|
|
|
<script src="../../resources/js-test-pre.js"></script>
|
|
<script type="text/javascript" charset="utf-8">
|
|
window.jsTestIsAsync = true;
|
|
|
|
// This function should be called.
|
|
var callback = function(event) {
|
|
testPassed("The callback function was called directly.");
|
|
finishJSTest();
|
|
};
|
|
// This function should not be called.
|
|
callback.handleEvent = function(event) {
|
|
testFailed("The callback function's handleEvent property was called instead of the function itself.");
|
|
finishJSTest();
|
|
};
|
|
|
|
// requestAnimationFrame is one of several uses of JS Callbacks
|
|
requestAnimationFrame(callback);
|
|
</script>
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
|
|
</body>
|
|
</html> |