File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -289,8 +289,7 @@ final public function setHtml($html)
289289 if (is_array ($ html )) {
290290 throw new Nette \InvalidArgumentException (sprintf ('Textual content must be a scalar, %s given. ' , gettype ($ html )));
291291 }
292- $ this ->removeChildren ();
293- $ this ->children [] = (string ) $ html ;
292+ $ this ->children = [(string ) $ html ];
294293 return $ this ;
295294 }
296295
@@ -300,15 +299,7 @@ final public function setHtml($html)
300299 */
301300 final public function getHtml (): string
302301 {
303- $ s = '' ;
304- foreach ($ this ->children as $ child ) {
305- if (is_object ($ child )) {
306- $ s .= $ child ->render ();
307- } else {
308- $ s .= $ child ;
309- }
310- }
311- return $ s ;
302+ return implode ('' , $ this ->children );
312303 }
313304
314305
@@ -323,7 +314,8 @@ final public function setText($text)
323314 if (!$ text instanceof IHtmlString) {
324315 $ text = htmlspecialchars ((string ) $ text , ENT_NOQUOTES , 'UTF-8 ' );
325316 }
326- return $ this ->setHtml ((string ) $ text );
317+ $ this ->children = [(string ) $ text ];
318+ return $ this ;
327319 }
328320
329321
You can’t perform that action at this time.
0 commit comments