File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
src/Tempest/View/src/Renderers Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ private function parseDom(string $template): NodeList
109109 $ template = str ($ template )
110110 // Convert self-closing and void tags
111111 ->replaceRegex (
112- regex: '/<(?<element>\w. *?)\/>/ ' ,
112+ regex: '/<(?<element>\w[^<] *?)\/>/ ' ,
113113 replace: function (array $ match ) {
114114 $ element = str ($ match ['element ' ])->trim ();
115115
Original file line number Diff line number Diff line change @@ -695,4 +695,15 @@ public function test_does_not_duplicate_br(): void
695695 <html lang="en"><head></head><body><br><hr></body></html>
696696 HTML, $ html );
697697 }
698+
699+ public function test_renders_minified_html_with_void_elements (): void
700+ {
701+ $ html = $ this ->render (<<<'HTML'
702+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M7 9.667A2.667 2.667 0 0 1 9.667 7h8.666A2.667 2.667 0 0 1 21 9.667v8.666A2.667 2.667 0 0 1 18.333 21H9.667A2.667 2.667 0 0 1 7 18.333z"/><path d="M4.012 16.737A2 2 0 0 1 3 15V5c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1"/></g></svg>
703+ HTML);
704+
705+ $ this ->assertStringEqualsStringIgnoringLineEndings (<<<'HTML'
706+ <svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewbox="0 0 24 24"><g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M7 9.667A2.667 2.667 0 0 1 9.667 7h8.666A2.667 2.667 0 0 1 21 9.667v8.666A2.667 2.667 0 0 1 18.333 21H9.667A2.667 2.667 0 0 1 7 18.333z"></path><path d="M4.012 16.737A2 2 0 0 1 3 15V5c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1"></path></g></svg>
707+ HTML, $ html );
708+ }
698709}
You can’t perform that action at this time.
0 commit comments