mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-01 06:51:32 +00:00

The website used to host every past test suite, copied into the www directory. We no longer need that on the website (and it makes the codebase impossible to search) so I removed all the old tests and the new tests are hosted simply at /test. I also replaced the www.js script with a simpler www.sh one (since we no longer need to do anything besides copying, really), which allowed me to remove a node dependency that was only used in that script.
36 lines
1.0 KiB
HTML
36 lines
1.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Aborting Request Event Test</title>
|
|
</head>
|
|
<body style="padding: 20px; font-family: sans-serif;">
|
|
<h1>Aborting Request Event Tests</h1>
|
|
<p>Aborting a request during an HTMX event should not prevent future events from firing.</p>
|
|
<label for="block">Block Request?</label>
|
|
<input id="block" type="checkbox" checked>
|
|
<br><br>
|
|
<button hx-get="https://httpbin.org/html"
|
|
hx-target="#target">
|
|
Send Request
|
|
</button>
|
|
<br><br>
|
|
<h3>Event Messages:</h3>
|
|
<div id="target"></div>
|
|
<script src="../../src/htmx.js"></script>
|
|
<script>
|
|
var btn = document.querySelector('button');
|
|
var checkbox = document.querySelector('input');
|
|
var target = document.querySelector('#target');
|
|
|
|
btn.addEventListener('htmx:beforeRequest', function(e) {
|
|
var messages = target.innerHTML;
|
|
target.innerHTML = messages + "<p>Another Message!</p>";
|
|
|
|
if (checkbox.checked) {
|
|
e.detail.xhr.abort();
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |