When loading HTML content with DomDocument it gets restructured.
I know that p tags are not allowed inside h1 but this is what I have to work with. Whilst the spec says it’s not allowed everything is still correctly nested (no missing closing tag etc.)
...
<h1>
<p>Nested paragraph</p>
</h1>
...
Then when run
$dom = new \DOMDocument('1.0', 'UTF-8');
$dom->loadHTML($content);
It will output like so
<h1>
</h1>
<p>Nested paragraph</p>
The p has been moved outside the h1. Is there a way to tell it not to care about matching the spec but just ensure tags are closed etc. How’s this going to work with custom elements in the future?