File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -391,6 +391,9 @@ private function handleAttributeBinding(DOMElement $node)
391
391
392
392
protected function handleTextNode (DOMText $ node )
393
393
{
394
+ if (!empty (trim ($ node ->textContent ))) {
395
+ $ node ->textContent = $ this ->builder ->refactorTextNode ($ node ->textContent );
396
+ }
394
397
return $ node ;
395
398
}
396
399
Original file line number Diff line number Diff line change @@ -170,6 +170,7 @@ public function refactorCondition(string $condition): string
170
170
$ condition = str_replace ('|| ' , 'or ' , $ condition );
171
171
$ condition = preg_replace ('/!([^=])/ ' , 'not $1 ' , $ condition );
172
172
$ condition = str_replace ('.length ' , '|length ' , $ condition );
173
+ $ condition = str_replace ('.trim ' , '|trim ' , $ condition );
173
174
174
175
foreach (Replacements::getConstants () as $ constant => $ value ) {
175
176
$ condition = str_replace ($ value , Replacements::getSanitizedConstant ($ constant ), $ condition );
@@ -178,6 +179,14 @@ public function refactorCondition(string $condition): string
178
179
return $ condition ;
179
180
}
180
181
182
+ public function refactorTextNode (string $ content ): string
183
+ {
184
+ $ content = str_replace ('.length ' , '|length ' , $ content );
185
+ $ content = str_replace ('.trim ' , '|trim ' , $ content );
186
+
187
+ return $ content ;
188
+ }
189
+
181
190
public function createVariableOutput ($ varName , ?string $ fallbackVariableName = null ): string
182
191
{
183
192
if ($ fallbackVariableName ) {
You can’t perform that action at this time.
0 commit comments