diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/markup/test/doc_markup_events_03.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/inspector/markup/test/doc_markup_events_03.html')
-rw-r--r-- | devtools/client/inspector/markup/test/doc_markup_events_03.html | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/doc_markup_events_03.html b/devtools/client/inspector/markup/test/doc_markup_events_03.html new file mode 100644 index 0000000000..a0c067e33e --- /dev/null +++ b/devtools/client/inspector/markup/test/doc_markup_events_03.html @@ -0,0 +1,103 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <style> + #es6-method, + #generator, + #anon-generator, + #named-function-expression, + #anon-function-expression, + #returned-function { + border: 1px solid #000; + width: 200px; + min-height: 1em; + cursor: pointer; + } + </style> + <script type="application/javascript"> + "use strict"; + + const namedFunctionExpression = + function foo() { + alert("namedFunctionExpression"); + } + + const anonFunctionExpression = function() { + alert("anonFunctionExpression"); + }; + + const returnedFunction = (function() { + return function bar() { + alert("returnedFunction"); + } + })(); + + /* exported init */ + function init() { + const em = new Es6Method(); + const es6Method = document.getElementById("es6-method"); + es6Method.addEventListener("click", em.es6Method); + + const generatorNode = document.getElementById("generator"); + generatorNode.addEventListener("click", generator); + + const anonGenerator = document.getElementById("anon-generator"); + anonGenerator.addEventListener("click", function* () { + alert("anonGenerator"); + }); + + const namedFunctionExpressionNode = + document.getElementById("named-function-expression"); + namedFunctionExpressionNode.addEventListener("click", + namedFunctionExpression); + + const anonFunctionExpressionNode = + document.getElementById("anon-function-expression"); + anonFunctionExpressionNode.addEventListener("click", + anonFunctionExpression); + + const returnedFunctionNode = document.getElementById("returned-function"); + returnedFunctionNode.addEventListener("click", returnedFunction); + } + + function Es6Method(hehe) { + + } + + Es6Method.prototype = { + es6Method(foo, bar) { + alert("obj.es6Method"); + } + }; + + function HandleEvent() { + const handleEventNode = document.getElementById("handleEvent"); + handleEventNode.addEventListener("click", this); + } + + HandleEvent.prototype = { + // eslint-disable-next-line object-shorthand + handleEvent: function(event) { + switch (event.type) { + case "click": + alert("handleEvent click"); + } + } + }; + + function* generator() { + alert("generator"); + } + </script> + </head> + <body onload="init();"> + <h1>Events test 3</h1> + <div id="es6-method">ES6 method</div> + <div id="generator">Generator</div> + <div id="anon-generator">Anonymous Generator</div> + <div id="named-function-expression">Named Function Expression</div> + <div id="anon-function-expression">Anonymous Function Expression</div> + <div id="returned-function">Returned Function</div> + </body> +</html> |