mirror of
https://github.com/bigskysoftware/htmx.git
synced 2026-04-19 05:16:13 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
8
src/htmx.d.ts
vendored
8
src/htmx.d.ts
vendored
@@ -429,13 +429,7 @@ export interface HtmxConfig {
|
||||
* If set to true htmx will not update the title of the document when a title tag is found in new content
|
||||
* @default false
|
||||
*/
|
||||
ignoreTitle:? boolean;
|
||||
/**
|
||||
* The cache to store evaluated trigger specifications into.
|
||||
* You may define a simple object to use a never-clearing cache, or implement your own system using a [proxy object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Proxy)
|
||||
* @default null
|
||||
*/
|
||||
triggerSpecsCache?: {[trigger: string]: HtmxTriggerSpecification[]};
|
||||
ignoreTitle?: boolean;
|
||||
}
|
||||
|
||||
export type HtmxEvent = "htmx:abort"
|
||||
|
||||
@@ -245,4 +245,46 @@ describe("Core htmx Regression Tests", function(){
|
||||
}, 50)
|
||||
})
|
||||
|
||||
it("script tags only execute once using templates", function(done) {
|
||||
var oldUseTemplateFragmentsValue = htmx.config.useTemplateFragments
|
||||
htmx.config.useTemplateFragments = true
|
||||
|
||||
window.i = 0; // set count to 0
|
||||
this.server.respondWith('GET', '/test', '<script>console.trace(); window.i++</script>') // increment the count by 1
|
||||
|
||||
// make a div w/ a short settle delay to make the problem more obvious
|
||||
var div = make('<div hx-get="/test" hx-swap="innerHTML settle:5ms"/>');
|
||||
div.click();
|
||||
this.server.respond()
|
||||
|
||||
htmx.config.useTemplateFragments = oldUseTemplateFragmentsValue
|
||||
|
||||
setTimeout(function(){
|
||||
window.i.should.equal(1);
|
||||
delete window.i;
|
||||
done();
|
||||
}, 50)
|
||||
})
|
||||
|
||||
it("script tags only execute once when nested using templates", function(done) {
|
||||
var oldUseTemplateFragmentsValue = htmx.config.useTemplateFragments
|
||||
htmx.config.useTemplateFragments = true
|
||||
|
||||
window.i = 0; // set count to 0
|
||||
this.server.respondWith('GET', '/test', '<p>foo</p><div><script>console.trace(); window.i++</script></div>') // increment the count by 1
|
||||
|
||||
// make a div w/ a short settle delay to make the problem more obvious
|
||||
var div = make('<div hx-get="/test" hx-swap="innerHTML settle:5ms"/>');
|
||||
div.click();
|
||||
this.server.respond()
|
||||
|
||||
htmx.config.useTemplateFragments = oldUseTemplateFragmentsValue
|
||||
|
||||
setTimeout(function(){
|
||||
window.i.should.equal(1);
|
||||
delete window.i;
|
||||
done();
|
||||
}, 50)
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user