Masterminds / html5-php

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

`<source>` in `<picture>` element will incorrectly be closed #243

Closed nilshoerrmann closed 7 months ago

nilshoerrmann commented 8 months ago

When parsing this picture element taken from MDN, the source element will not be treated as void element but closed instead:

<picture>
  <source srcset="/media/cc0-images/surfer-240-200.jpg" media="(orientation: portrait)" />
  <img src="/media/cc0-images/painted-hand-298-332.jpg" alt="" />
</picture>

This will become:

<picture>
  <source srcset="/media/cc0-images/surfer-240-200.jpg" media="(orientation: portrait)"></source>
  <img src="/media/cc0-images/painted-hand-298-332.jpg" alt="">
</picture>

The expected output would be:

<picture>
  <source srcset="/media/cc0-images/surfer-240-200.jpg" media="(orientation: portrait)">
  <img src="/media/cc0-images/painted-hand-298-332.jpg" alt="">
</picture>
nilshoerrmann commented 7 months ago

This must have been an issue in my codebase as I cannot reproduce the issue anymore.