Masterminds / html5-php

An HTML5 parser and serializer for PHP.
http://masterminds.github.io/html5-php/
Other
1.55k stars 114 forks source link

Mark `<video>` tag as inline element #232

Closed HypeMC closed 1 year ago

HypeMC commented 1 year ago

The <video> tag is incorrectly marked as a block element, while it's actually an inline one according to MDN.

This causes the following problem:

use Masterminds\HTML5;

$html5 = new HTML5();
$dom = $html5->loadHTMLFragment('<p>Test: <video><source src="/path/to/video.mp4" /></video></p>');
echo $html5->saveHTML($dom);

Result:

<p>Test: </p><video><source src="/path/to/video.mp4"></video>

Even though having a <video> tag inside a <p> tag is valid HTML, it gets moved outside the <p> tag.

goetas commented 1 year ago

thank you