Skip to content

Commit

Permalink
improve the code check for performance
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jan 12, 2024
1 parent 90a2298 commit 36bd563
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@ public String preProcess(final HtmlPage htmlPage, final String sourceCode, final

String patchedSourceCode = sourceCode;

if (sourceName.contains("/htmx.js")) {
if (sourceName.contains("/htmx.js") && !sourceName.contains("/htmx.js#")) {
patchedSourceCode = StringUtils.replace(
sourceCode,
"function makeTagRegEx(tag, global = false) {",
"function makeTagRegEx(tag) {\n"
+ " "
+ "var global = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n");
+ " "
+ "var global = arguments.length > 1 && arguments[1] !== undefined "
+ "? arguments[1] : false;\n");
}
else if (sourceName.contains("/htmx.min.js")) {
else if (sourceName.contains("/htmx.min.js") && !sourceName.contains("/htmx.min.js#")) {
patchedSourceCode = StringUtils.replace(
sourceCode,
"function e(e,t=false){",
"function e(e){"
+ "var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; ");
+ "var t = arguments.length > 1 && arguments[1] !== undefined "
+ "? arguments[1] : false; ");
}

if (nextScriptPreProcessor_ != null) {
Expand Down

0 comments on commit 36bd563

Please # to comment.