Bug #80743 [NEW]: DOMDocument saveHTML() creates invalid source element

From: Date: Sat, 13 Feb 2021 10:01:21 +0000
Subject: Bug #80743 [NEW]: DOMDocument saveHTML() creates invalid source element
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232124@lists.php.net to get a copy of this message
From:             ic dot czech+php at gmail dot com
Operating system: linux & win
PHP version:      8.0.2
Package:          DOM XML related
Bug Type:         Bug
Bug description:DOMDocument saveHTML() creates invalid source element

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 bug report at https://bugs.php.net/bug.php?id=80743&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=80743&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=80743&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=80743&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=80743&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=80743&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=80743&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=80743&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=80743&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=80743&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=80743&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80743&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=80743&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=80743&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=80743&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=80743&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=80743&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=80743&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#232124) next »