#37801 [Opn->Fbk]: PHP doesn't see the ID of input elements
| From: | bjori@php.net | Date: | Wed, 14 Jun 2006 12:31:43 +0000 |
| Subject: | #37801 [Opn->Fbk]: PHP doesn't see the ID of input elements | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-98343@lists.php.net to get a copy of this message | ||
ID: 37801
Updated by: bjori@php.net
Reported By: wilco at pangeadc dot nl
-Status: Open
+Status: Feedback
Bug Type: DOM XML related
Operating System: windows
PHP Version: 5.1.4
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2006-06-14 11:42:49] wilco at pangeadc dot nl
Description:
------------
It seems to me PHP is unable to find the ID of input elements using the
loadHTML function.
I've tried many combinations and I can locate any element with this
script accept the input. The problem also occures on
domdoccument::getElementById.
Reproduce code:
---------------
<?PHP
$htmlcode = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0
Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html><head><title>Foo my bar</title></head>
<body><input id=\"my_input\" /><textarea cols=\"3\"
rows=\"2\"
id=\"my_textarea\" /></body>
</html>";
$html = new DOMDocument();
$html->loadHTML($htmlcode);
$html->validate();
$input = $html->getElementsByTagName('input')->item(0);
echo "input: ";
var_dump($input->getAttributeNode('id')->isId());
$textarea = $html->getElementsByTagName('textarea')->item(0);
echo "textarea: ";
var_dump($textarea->getAttributeNode('id')->isId());
?>
Expected result:
----------------
input: bool(true)
textarea: bool(true)
Actual result:
--------------
input: bool(false)
textarea: bool(true)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37801&edit=1