mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
prep 1.9.7 release
This commit is contained in:
parent
8ddd079b90
commit
61dac7d933
7
dist/ext/response-targets.js
vendored
7
dist/ext/response-targets.js
vendored
@ -5,6 +5,11 @@
|
|||||||
|
|
||||||
var attrPrefix = 'hx-target-';
|
var attrPrefix = 'hx-target-';
|
||||||
|
|
||||||
|
// IE11 doesn't support string.startsWith
|
||||||
|
function startsWith(str, prefix) {
|
||||||
|
return str.substring(0, prefix.length) === prefix
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {HTMLElement} elt
|
* @param {HTMLElement} elt
|
||||||
* @param {number} respCode
|
* @param {number} respCode
|
||||||
@ -38,7 +43,7 @@
|
|||||||
'***',
|
'***',
|
||||||
'xxx',
|
'xxx',
|
||||||
];
|
];
|
||||||
if (respCode.startsWith('4') || respCode.startsWith('5')) {
|
if (startsWith(respCode, '4') || startsWith(respCode, '5')) {
|
||||||
attrPossibilities.push('error');
|
attrPossibilities.push('error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
|
|
||||||
var attrPrefix = 'hx-target-';
|
var attrPrefix = 'hx-target-';
|
||||||
|
|
||||||
|
// IE11 doesn't support string.startsWith
|
||||||
|
function startsWith(str, prefix) {
|
||||||
|
return str.substring(0, prefix.length) === prefix
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {HTMLElement} elt
|
* @param {HTMLElement} elt
|
||||||
* @param {number} respCode
|
* @param {number} respCode
|
||||||
@ -38,7 +43,7 @@
|
|||||||
'***',
|
'***',
|
||||||
'xxx',
|
'xxx',
|
||||||
];
|
];
|
||||||
if (respCode.startsWith('4') || respCode.startsWith('5')) {
|
if (startsWith(respCode, '4') || startsWith(respCode, '5')) {
|
||||||
attrPossibilities.push('error');
|
attrPossibilities.push('error');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,8 @@ describe("hx-on attribute", function() {
|
|||||||
|
|
||||||
it("can handle event types with dots", function () {
|
it("can handle event types with dots", function () {
|
||||||
var btn = make("<button hx-on='my.custom.event: window.foo = true'>Foo</button>");
|
var btn = make("<button hx-on='my.custom.event: window.foo = true'>Foo</button>");
|
||||||
btn.dispatchEvent(new CustomEvent('my.custom.event'));
|
// IE11 doesn't support `new CustomEvent()` so call htmx' internal utility function
|
||||||
|
btn.dispatchEvent(htmx._("makeEvent")('my.custom.event'));
|
||||||
window.foo.should.equal(true);
|
window.foo.should.equal(true);
|
||||||
delete window.foo;
|
delete window.foo;
|
||||||
});
|
});
|
||||||
|
@ -29,6 +29,11 @@ describe('Core htmx extension tests', function() {
|
|||||||
onEvent: function(name, evt) {
|
onEvent: function(name, evt) {
|
||||||
if (name === 'htmx:beforeRequest') {
|
if (name === 'htmx:beforeRequest') {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
if (IsIE11()) {
|
||||||
|
// IE11 doesn't set defaultPrevented to true on custom events it seems, so use a
|
||||||
|
// return false instead to cancel the event
|
||||||
|
return false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -168,7 +168,7 @@
|
|||||||
|
|
||||||
<script class="mocha-exec">
|
<script class="mocha-exec">
|
||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
mocha.setup({globals: ['$0', '$1', '$2', '$3', '$4', 'performance', 'requestAnimationFrame', 'cancelAnimationFrame']}); <!-- IE11 -->
|
mocha.setup({globals: ['$0', '$1', '$2', '$3', '$4', 'performance', 'requestAnimationFrame', 'cancelAnimationFrame', 'confirm']}); <!-- IE11 -->
|
||||||
mocha.run();
|
mocha.run();
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user