logo       

[ tidy-Bugs-1263391 ] ADDRESS tag is wrongly defined as BLOCK container: msg#00090

web.html-tidy.tracker

Subject: [ tidy-Bugs-1263391 ] ADDRESS tag is wrongly defined as BLOCK container

Bugs item #1263391, was opened at 2005-08-18 20:13
Message generated for change (Settings changed) made by arnaud02
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=390963&aid=1263391&group_id=27659

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: HTML/XML/XHTML Parser
Group: Future - all platforms
>Status: Pending
>Resolution: Fixed
Priority: 5
Submitted By: Marc Gueury (mgueury)
Assigned to: Nobody/Anonymous (nobody)
Summary: ADDRESS tag is wrongly defined as BLOCK container

Initial Comment:
An user reported this error, when validating this page,
tidy is reporting no error:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";
xml:lang="fr" lang="fr">
<head>
<title>My page </title>
</head>
<body id="cv">
This should return 2 HTML errors. But there is none<br/>
DIV or UL are not allowed in address<br/>
<address id="contact_postal">
<div id="identite">toto titi</div>
<div id="adresse">
1st street<br />
23X52 - NY <br />
</div>
</address>
<hr />
<address id="contact_autre">
<ul id="contact_tel">
<li id="portable">...</li>
<li id="fixe">...</li>
</ul>
<a id="adresse_mail"
href="/path/to/contact/page">contact name</a>
</address>
</body>
</html>

But Address is a block tag that can contain only inline
tags. If you validate that page in validator.w3.org, it
will
generate some error for the DIV or UL contained in the
address tag.

--------------------------------------------------------------
Possible Fix

This is due to a bad definition of the tag address in
tag.c.

BAD:
...
{ TidyTag_ADDRESS, "address",
VERS_ELEM_ADDRESS, &W3CAttrsFor_ADDRESS[0],
(CM_BLOCK),
ParseBlock, NULL },

GOOD
...
{ TidyTag_ADDRESS, "address",
VERS_ELEM_ADDRESS, &W3CAttrsFor_ADDRESS[0],
(CM_BLOCK),
ParseInline, NULL },

----------------------------------------------------------------------
Reference:
http://www.w3.org/TR/html4/struct/global.html#edef-ADDRESS

Thanks by advance

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

>Comment By: Arnaud Desitter (arnaud02)
Date: 2005-08-23 14:07

Message:
Logged In: YES
user_id=566665

Fixed in CVS.


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

Comment By: Marc Gueury (mgueury)
Date: 2005-08-18 21:49

Message:
Logged In: YES
user_id=74628

-----------------------------------------------------------------------------------
/* within <address> accept also <p> */
if ( nodeIsP(node) &&
node->type == StartTag &&
nodeIsADDRESS(element)
)
{
InsertNodeAtEnd(element, node);
(*node->tag->parser)( doc, node, mode );
continue;
}
-----------------------------------------------------------------------------------

This is better. Can you double-check ? Thanks by advance


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

Comment By: Marc Gueury (mgueury)
Date: 2005-08-18 21:44

Message:
Logged In: YES
user_id=74628

Please ignore the last update it is just partially correct.
I need to work more on it.

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

Comment By: Marc Gueury (mgueury)
Date: 2005-08-18 21:42

Message:
Logged In: YES
user_id=74628

Yes... I completely missed that <P>.

So, I worked on it. Here is another complementary possible
fix to take care of the <P> but it does not take care of
it is HTML strict or HTML loose or XHTML

in parser.c, about line 1466
-------------------------------------------------------------------------------
InsertNodeAtEnd(element, node);
continue;
}

// THIS IS THE NEW CODE
/* within <address> accept also <p> */
if ( nodeIsP(node) &&
node->type == StartTag &&
nodeIsADDRESS(element)
)
{
(*node->tag->parser)( doc, node, mode );
continue;
}


/* ignore unknown and PARAM tags */
if ( node->tag == NULL || nodeIsPARAM(node) )
-------------------------------------------------------------------------------

It seems to make the trick in the test file I created.
Maybe it could be improved. But it looks already better.

Thanks



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

Comment By: Björn Höhrmann (hoehrmann)
Date: 2005-08-18 20:38

Message:
Logged In: YES
user_id=188003

http://www.w3.org/TR/html4/sgml/loosedtd.html

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

Comment By: Nobody/Anonymous (nobody)
Date: 2005-08-18 20:28

Message:
Logged In: NO

Hi Bjoern,

You are right. It did not took care about the <p> tag.
I was seeing this in the 4.01 DTD

<!ELEMENT ADDRESS - - (%inline;)* -- information on author -->
<!ATTLIST ADDRESS
%attrs; -- %coreattrs, %i18n,
%events --
>

I see no <p> defined there ? Can you explain what I am missing ?

Thanks by advance,

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

Comment By: Björn Höhrmann (hoehrmann)
Date: 2005-08-18 20:20

Message:
Logged In: YES
user_id=188003

In HTML 4.01 Transitional <address> may contain inline
elements and <p> elements, it seems your patch would break
that.

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

Comment By: Marc Gueury (mgueury)
Date: 2005-08-18 20:13

Message:
Logged In: YES
user_id=74628

The testcase is also attached to the bug.

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

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=390963&aid=1263391&group_id=27659


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise