DOMDocument saveHTML() configurable?
| From: | Michael A. Peters | Date: | Fri, 10 Jul 2009 05:17:46 +0000 |
| Subject: | DOMDocument saveHTML() configurable? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-295124@lists.php.net to get a copy of this message | ||
The $dom->saveHTML() function does a pretty good job of knowing what tags are not closed - IE it does <br>, <meta>, <param>, etc. correctly.
Is there a way to add a tag without children to it's database?
Specifically I'm talking about the new <source> tag from HTML 5 that is being used to embed ogg/mp4 audio and video files.
Put it in a dom document object and spit it out with saveHTML() and you get <source src="foo.ogg" type="video/ogg"></source> which is harmless but technically incorrect.
I know html tidy allows you to define new childless nodes and sending the output through tidy will then fix it, but I can't seem to find a way to to it with DOMDocument so that you don't need to send it through tidy before sending to the client.