public class HtmxTwoZeroSevenScriptPreProcessor extends Object implements ScriptPreProcessor
ScriptPreProcessor implementation that applies compatibility patches to
 htmx 2.0.3 - 2.0.7 versions of the htmx JavaScript library.
 This preprocessor rewrites certain ECMAScript syntax constructs (such as spread operator usage in array push and for-of loops over array copies) to equivalent ES5-compatible code. This is necessary because these features are not yet supported by the JavaScript engine htmlunit-corejs (Rhino).
 The class can be chained with other ScriptPreProcessor instances via its constructor.
 
Supported patches include:
result.push(...toArray(...)) with result.push.apply(result, toArray(...))result.push(...findAttributeTargets(...)) with result.push.apply(result, findAttributeTargets(...))for (const preservedElt of [...pantry.children]) with for (const preservedElt of Array.from(pantry.children))htmx.min.js)Usage Example:
 try (WebClient webClient = new WebClient()) {
     webClient.setScriptPreProcessor(new HtmxTwoZeroSevenScriptPreProcessor());
     // use webClient as needed
 }
 ScriptPreProcessor| Constructor and Description | 
|---|
| HtmxTwoZeroSevenScriptPreProcessor()Ctor. | 
| HtmxTwoZeroSevenScriptPreProcessor(ScriptPreProcessor nextScriptPreProcessor)Ctor. | 
| Modifier and Type | Method and Description | 
|---|---|
| String | preProcess(HtmlPage htmlPage,
          String sourceCode,
          String sourceName,
          int lineNumber,
          HtmlElement htmlElement)Pre process the specified source code in the context of the given page. | 
public HtmxTwoZeroSevenScriptPreProcessor()
public HtmxTwoZeroSevenScriptPreProcessor(ScriptPreProcessor nextScriptPreProcessor)
nextScriptPreProcessor - the next ScriptPreProcessorpublic String preProcess(HtmlPage htmlPage, String sourceCode, String sourceName, int lineNumber, HtmlElement htmlElement)
preProcess in interface ScriptPreProcessorhtmlPage - the pagesourceCode - the code to executesourceName - a name for the chunk of code that is going to be executed (used in error messages)lineNumber - the line number of the source codehtmlElement - the HTML element that will act as the contextCopyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.