From e0b5b52979e9e32c20a7d635d7f9cfef16c0b34e Mon Sep 17 00:00:00 2001 From: carson Date: Wed, 11 Nov 2020 10:04:01 -0700 Subject: [PATCH] handle html parsing when script tag starts content fixes https://github.com/bigskysoftware/htmx/issues/228 --- src/htmx.js | 2 ++ test/core/ajax.js | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/htmx.js b/src/htmx.js index 597d3fef..d0b42179 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -161,6 +161,8 @@ return (function () { case "td": case "th": return parseHTML("" + resp + "
", 3); + case "script": + return parseHTML("
" + resp + "
", 1); default: return parseHTML(resp, 0); } diff --git a/test/core/ajax.js b/test/core/ajax.js index f3a062ff..1db00579 100644 --- a/test/core/ajax.js +++ b/test/core/ajax.js @@ -546,6 +546,23 @@ describe("Core htmx AJAX Tests", function(){ } }); + it('stand alone script nodes evaluate', function() + { + var globalWasCalled = false; + window.callGlobal = function() { + globalWasCalled = true; + } + try { + this.server.respondWith("GET", "/test", ""); + var div = make("
"); + div.click(); + this.server.respond(); + globalWasCalled.should.equal(true); + } finally { + delete window.callGlobal; + } + }); + it('child script nodes evaluate when children', function() { var globalWasCalled = false;