List Info

Thread: DomTestCase where id == name




DomTestCase where id == name
country flaguser name
United States
2007-06-09 02:07:03
Hey there,

  DomTestCase uses loadHTML to set up the DOM. However,
this
sometimes throws exceptions when I attempt an
assertElementsBySelector
against a perfectly valid XHTML 1.0 Transitional pages.
Specifically,
there is a problem when loading a page with an element of
the following
form:

<textarea id="same" name="same"
/>

The <input> tag doesn't have this problem, but many
other tags do.
Removing the name makes the error go away, as does setting
loadExternals to true and calling loadXML. This smells like
a PHP bug,
but it hurts simpletest functionality either way (getting a
zillion
spurious "exception" notices at the end of a run
isn't a very pleasant
experience).

I've switched to loading XML and performing validation with
my local
DomTestCase as a workaround for the time being.


test.php:
---------

<?php

$dom = new DomDocument();
$dom->loadHTMLFile('test.html');

?>



test.html:
----------

<?xml version="1.0"
encoding="UTF-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quo
t;>
<html xmlns="http://www.w3.org/
1999/xhtml" xml:lang="en"
lang="en">
<head>
<title>Test</title>
</head>
<body>
<p>
<a href="#" name="anotherbug"
id="anotherbug">Woot!</a>
</p>
<form action="" method="post">
<p>
<input type="text" id="notabug"
name="notabug" />
<textarea name="bug" id="bug"
rows="10" cols="60" />
<button type="submit"
id="yetanotherbug" name="yetanotherbug"
/>
</p>
</form>
</body>
</html>


Output:
-------

Warning: DOMDocument::loadHTMLFile(): ID anotherbug already
defined in
test.html, line: 11
in /home/blazer/src/in-series-svn/in-series-test/test.php on
line 4

Warning: DOMDocument::loadHTMLFile(): ID bug already defined
in
test.html, line: 16
in /home/blazer/src/in-series-svn/in-series-test/test.php on
line 4

Warning: DOMDocument::loadHTMLFile(): ID yetanotherbug
already defined
in test.html, line: 17
in /home/blazer/src/in-series-svn/in-series-test/test.php on
line 4



-- 
Travis

------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

Re: DomTestCase where id == name
user name
2007-06-09 04:51:42
Aren't you supposed to write <textarea> like this:
<textarea name="bug" id="bug"
rows="10"
cols="60"></textarea>

On 6/9/07, Travis Snoozy <ai2097users.sourceforge.net>
wrote:
> Hey there,
>
>   DomTestCase uses loadHTML to set up the DOM. However,
this
> sometimes throws exceptions when I attempt an
assertElementsBySelector
> against a perfectly valid XHTML 1.0 Transitional pages.
Specifically,
> there is a problem when loading a page with an element
of the following
> form:
>
> <textarea id="same" name="same"
/>
>
> The <input> tag doesn't have this problem, but
many other tags do.
> Removing the name makes the error go away, as does
setting
> loadExternals to true and calling loadXML. This smells
like a PHP bug,
> but it hurts simpletest functionality either way
(getting a zillion
> spurious "exception" notices at the end of a
run isn't a very pleasant
> experience).
>
> I've switched to loading XML and performing validation
with my local
> DomTestCase as a workaround for the time being.
>
>
> test.php:
> ---------
>
> <?php
>
> $dom = new DomDocument();
> $dom->loadHTMLFile('test.html');
>
> ?>
>
>
>
> test.html:
> ----------
>
> <?xml version="1.0"
encoding="UTF-8"?>
> <!DOCTYPE html
>      PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
>      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quo
t;>
> <html xmlns="http://www.w3.org/
1999/xhtml" xml:lang="en"
lang="en">
> <head>
> <title>Test</title>
> </head>
> <body>
> <p>
> <a href="#" name="anotherbug"
id="anotherbug">Woot!</a>
> </p>
> <form action=""
method="post">
> <p>
> <input type="text" id="notabug"
name="notabug" />
> <textarea name="bug" id="bug"
rows="10" cols="60" />
> <button type="submit"
id="yetanotherbug" name="yetanotherbug"
/>
> </p>
> </form>
> </body>
> </html>
>
>
> Output:
> -------
>
> Warning: DOMDocument::loadHTMLFile(): ID anotherbug
already defined in
> test.html, line: 11
> in
/home/blazer/src/in-series-svn/in-series-test/test.php on
line 4
>
> Warning: DOMDocument::loadHTMLFile(): ID bug already
defined in
> test.html, line: 16
> in
/home/blazer/src/in-series-svn/in-series-test/test.php on
line 4
>
> Warning: DOMDocument::loadHTMLFile(): ID yetanotherbug
already defined
> in test.html, line: 17
> in
/home/blazer/src/in-series-svn/in-series-test/test.php on
line 4
>
>
>
> --
> Travis
>
>
------------------------------------------------------------
-------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2
express and take
> control of your XML. No limits. Just data. Click to get
it now.
> http://sourcefor
ge.net/powerbar/db2/
> _______________________________________________
> Simpletest-support mailing list
> Simpletest-supportlists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/simp
letest-support
>

------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

Re: DomTestCase where id == name
country flaguser name
United States
2007-06-09 04:59:07
On Sat, 9 Jun 2007 10:51:42 +0100, "Oliver
Saunders"
<oliver.saunderstillingproductions.com> wrote:

> Aren't you supposed to write <textarea> like
this:
> <textarea name="bug" id="bug"
rows="10"
cols="60"></textarea>

<snip>

(1) It's still valid XHTML the way it is, (2) loadHTML
doesn't gripe
about it, and (3) it doesn't affect the exceptions that are
generated.
So, yeah, it's not technically HTML compatible, but it
doesn't
particularly matter. Feel free to change it if you desire.


-- 
Travis

------------------------------------------------------------
-------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and
take
control of your XML. No limits. Just data. Click to get it
now.
http://sourcefor
ge.net/powerbar/db2/
_______________________________________________
Simpletest-support mailing list
Simpletest-supportlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/simp
letest-support

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )