File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
src/Tempest/View/src/Renderers Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -108,13 +108,15 @@ private function parseDom(string $template): HTMLDocument|NodeList
108108 ->trim ()
109109 ->startsWith (['<html ' , '<!DOCTYPE ' , '<!doctype ' ]);
110110
111+ $ parserFlags = LIBXML_HTML_NOIMPLIED | LIBXML_NOERROR | HTML_NO_DEFAULT_NS ;
112+
111113 if ($ isFullHtmlDocument ) {
112114 // If we're rendering a full HTML document, we'll parse it as is
113- return HTMLDocument::createFromString ($ template ->toString (), LIBXML_NOERROR | HTML_NO_DEFAULT_NS );
115+ return HTMLDocument::createFromString ($ template ->toString (), $ parserFlags );
114116 }
115117
116118 // If we're rendering an HTML snippet, we'll wrap it in a div, and return the resulting nodelist
117- $ dom = HTMLDocument::createFromString ("<div id='tempest_render'> {$ template }</div> " , LIBXML_NOERROR | HTML_NO_DEFAULT_NS );
119+ $ dom = HTMLDocument::createFromString ("<div id='tempest_render'> {$ template }</div> " , $ parserFlags );
118120
119121 return $ dom ->getElementById ('tempest_render ' )->childNodes ;
120122 }
Original file line number Diff line number Diff line change @@ -500,7 +500,7 @@ public function test_empty_slots_are_commented_out(): void
500500 HTML);
501501
502502 $ this ->assertStringEqualsStringIgnoringLineEndings (<<<'HTML'
503- <html lang="en"><head><!--<x-slot name="styles" ></x-slot>--><link rel="stylesheet" href="#"></link></head><body></body>< /html>
503+ <html lang="en"><head><!--<x-slot name="styles" ></x-slot>--><link rel="stylesheet" href="#"></link></head></html>
504504 HTML, $ html );
505505 }
506506}
You can’t perform that action at this time.
0 commit comments