Bug #80743 [Opn->Nab]: DOMDocument saveHTML() creates invalid source element

From: Date: Thu, 18 Feb 2021 11:38:01 +0000
Subject: Bug #80743 [Opn->Nab]: DOMDocument saveHTML() creates invalid source element
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232243@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80743&edit=1 ID: 80743 Updated by: cmb@php.net Reported by: ic dot czech+php at gmail dot com Summary: DOMDocument saveHTML() creates invalid source element -Status: Open +Status: Not a bug Type: Bug Package: DOM XML related Operating System: linux & win PHP Version: 8.0.2 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: libxml2 doesn't know about <source> elements[1], and there is not much we can do about that. Consider to report this to upstream[2] (although I presume that they are aware of this issue). [1] <https://github.com/GNOME/libxml2/blob/cbe1212db6e22fa92c33242c3ce089476585f872/HTMLparser.c#L610> [2] <http://www.xmlsoft.org/bugs.html> Previous Comments: ------------------------------------------------------------------------ [2021-02-13 10:01:21] ic dot czech+php at gmail dot com Description: ------------ Native DOMDocument's method saveHTML() creates paired tag from picture/video source element, but according to https://www.w3.org/TR/2011/WD-html5-author-20110809/the-source-element.html it should be unpaired element. It works well with another unpaired elements like meta, img, br, hr, … . But it filed with source ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source ) . Test script: --------------- <?php const ELEMENT_NAME = 'source'; // meta / img / br / hr $document = new DOMDocument( '1.0', 'UTF-8' ); $element = $document->createElement(ELEMENT_NAME); $document->appendChild($element); echo $document->saveHTML(); // writes '<source></source>' but according to https://www.w3.org/TR/2011/WD-html5-author-20110809/the-source-element.html it should be '<source>' Expected result: ---------------- <source> Actual result: -------------- <source></source> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80743&edit=1

« previous php.bugs (#232243) next »