|
14 | 14 | */ |
15 | 15 | package org.htmlunit.javascript.preprocessor; |
16 | 16 |
|
17 | | -import org.apache.commons.lang3.StringUtils; |
18 | 17 | import org.htmlunit.ScriptPreProcessor; |
19 | 18 | import org.htmlunit.html.HtmlElement; |
20 | 19 | import org.htmlunit.html.HtmlPage; |
@@ -78,41 +77,34 @@ public String preProcess(final HtmlPage htmlPage, final String sourceCode, final |
78 | 77 | String patchedSourceCode = sourceCode; |
79 | 78 |
|
80 | 79 | if (sourceName.contains("/htmx.js") && !sourceName.contains("/htmx.js#")) { |
81 | | - patchedSourceCode = StringUtils.replace( |
82 | | - sourceCode, |
| 80 | + patchedSourceCode = sourceCode.replace( |
83 | 81 | "result.push(...toArray(rootNode.querySelectorAll(standardSelector)))", |
84 | 82 | "result.push.apply(result, toArray(rootNode.querySelectorAll(standardSelector)))"); |
85 | 83 |
|
86 | | - patchedSourceCode = StringUtils.replace( |
87 | | - patchedSourceCode, |
| 84 | + patchedSourceCode = patchedSourceCode.replace( |
88 | 85 | "result.push(...findAttributeTargets(eltToInheritFrom, attrName))", |
89 | 86 | "result.push.apply(result, findAttributeTargets(eltToInheritFrom, attrName))"); |
90 | 87 |
|
91 | | - patchedSourceCode = StringUtils.replace( |
92 | | - patchedSourceCode, |
| 88 | + patchedSourceCode = patchedSourceCode.replace( |
93 | 89 | "for (const preservedElt of [...pantry.children]) {", |
94 | 90 | "for (const preservedElt of Array.from(pantry.children)) {"); |
95 | 91 | } |
96 | 92 | else if (sourceName.contains("/htmx.min.js") && !sourceName.contains("/htmx.min.js#")) { |
97 | 93 | // 2.0.4 |
98 | | - patchedSourceCode = StringUtils.replace( |
99 | | - sourceCode, |
| 94 | + patchedSourceCode = sourceCode.replace( |
100 | 95 | "i.push(...M(c.querySelectorAll(e)))", |
101 | 96 | "i.push.apply(i,M(c.querySelectorAll(e)))"); |
102 | 97 |
|
103 | 98 | // 2.0.7 |
104 | | - patchedSourceCode = StringUtils.replace( |
105 | | - patchedSourceCode, |
| 99 | + patchedSourceCode = patchedSourceCode.replace( |
106 | 100 | "i.push(...F(c.querySelectorAll(e)))", |
107 | 101 | "i.push.apply(i,F(c.querySelectorAll(e)))"); |
108 | 102 |
|
109 | | - patchedSourceCode = StringUtils.replace( |
110 | | - patchedSourceCode, |
| 103 | + patchedSourceCode = patchedSourceCode.replace( |
111 | 104 | "r.push(...we(i,n))", |
112 | 105 | "r.push.apply(r,we(i,n))"); |
113 | 106 |
|
114 | | - patchedSourceCode = StringUtils.replace( |
115 | | - patchedSourceCode, |
| 107 | + patchedSourceCode = patchedSourceCode.replace( |
116 | 108 | "for(const t of[...e.children]){", |
117 | 109 | "for(const t of Array.from(e.children)){"); |
118 | 110 | } |
|
0 commit comments