Edit report at http://bugs.php.net/bug.php?id=51530&edit=1

 ID:               51530
 Updated by:       rricha...@php.net
 Reported by:      jameswithers89 at googlemail dot com
 Summary:          DOMDocument::createElement() does not handle <link>
                   correctly
-Status:           Open
+Status:           Bogus
 Type:             Bug
 Package:          DOM XML related
 Operating System: Fedora 12 GNU/Linux
 PHP Version:      5.3.2

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

use saveXML to produce XHTML. In regular HTML link tag has no closing
tag


Previous Comments:
------------------------------------------------------------------------
[2010-04-11 02:16:01] jameswithers89 at googlemail dot com

Description:
------------
DOMDocument::createElement() does not add a closing </link> tag with
DOMDocument::createElement('link'). It outputs <element> rather than
<element></element>.



I am using php-5.3.2-1.fc12.i686 and php-xml-5.3.2-1.fc12.i686 installed
using Yellowdog Updater, Modified Package Manager. All other DOM methods
tried so far work fine.

Test script:
---------------
<?php

$implementation = new DOMImplementation();

$document = $implementation->createDocument(null, null,
$implementation->createDocumentType('html'));

$html = $document->createElement('html');

$head = $document->createElement('head');

$stylesheet = $document->createElement('link');

$title = $document->createElement('title', 'Possible link error');

$body = $document->createElement('body');

$html->setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');

$stylesheet->setAttribute('href','style.css');

$stylesheet->setAttribute('rel','stylesheet');

$stylesheet->setAttribute('type','text/css');

$document->appendChild($html);

$html->appendChild($head);

$html->appendChild($body);

$head->appendChild($stylesheet);

$head->appendChild($title);

echo $document->saveHTML();

Expected result:
----------------
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml";>

<head>

<link href="style.css" rel="stylesheet" type="text/css"></link>

<title>Possible link error</title>

</head>

<body></body>

</html>

Actual result:
--------------
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml";>

<head>

<link href="style.css" rel="stylesheet" type="text/css">

<title>Possible link error</title>

</head>

<body></body>

</html>




------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51530&edit=1

Reply via email to