W3C home > Mailing lists > Public > html-tidy@w3.org > October to December 2002

Re: Empty <div> tags

From: Charles Reitzel <creitzel@rcn.com>
Date: Tue, 17 Dec 2002 11:56:40 -0500
Message-Id: <4.3.2.7.2.20021217114307.02d82888@pop.rcn.com>
To: Bjoern Hoehrmann <derhoermi@gmx.net>
Cc: html-tidy@w3.org

I was thinking along similar lines.  Perhaps it would be good to fold in 
dropping/keeping of unknown tags.  Not sure.

I'll use your comments as a guide.  I want to experiment with the sample 
file that Charlie Cox sent us to see what the visual impact is on 
IE6/NS6.  His patch is simple enough, but I think getting a deeper 
understanding of how styles get applied will be worthwhile.  I don't see 
how an empty div can be used to apply any style, positional or 
otherwise.  Seems like useless text.  But Charlie claims his docs are 
broken.  So it immediately begs the question: what is the GCD cross-browser 
behavior that Tidy can expect?  I'd like to end up with a few sample files 
that maybe other folks can confirm/deny my findings on other browsers.  My 
selection is fairly limited these days.

take it easy,
Charlie

P.S. FYI, Lee put in that change wrt empty paragraphs.  If 
--drop-empty-paras no, then <p></p> => <p>&nbsp;</p>.


At 06:35 AM 12/17/2002 +0100, Bjoern Hoehrmann wrote:

>* Charles Reitzel wrote:
> >Thanks for your input.  Björn, can you weigh in on empty elements with
> >attributes?  Are they prunable or no?
>
>It's most likely that empty non-empty non-replaced elements (br is an
>empty element, object is a replaced element) are used to control the
>presentation of the document. Using elements that way is bad practise
>and in general I think Tidy should remove or replace them, independently
>of whether they have some attributes specified. There are some
>exceptions like <td>, <a name='...'>, maybe <li> and <dd> and probably
>others. However, removing them might cause problems as in the example
>Liam provided. For <p> Tidy has a --drop-empty-paras option to control
>removal of empty <p> elements,
>
>   <div>...<p></p>...</div>
>
>Will be cleaned to
>
>   <div>......</div>
>
>or
>
>   <div>...<br><br>...</div>
>
>depending of the value given for the mentioned option. Using something
>similar in a more general fashion, i.e., for all empty elements, but
>changing
>
><div>...<div style="
>   position:         absolute;
>   top:              168px;
>   left:             0px;
>   width:            729px;
>   border-top-style: solid;
>   border-top-width: 1px;
>   border-top-color: #000000;">...</div>
>
>to
>
><div>...<br><br>...</div>
>
>will not help Charlie (while it deals with Liam's case). The most easy
>solution would be a new config option
>
>   empty-elements: auto | keep
>
>Where 'auto' is the current behaivour and 'keep' keeps all empty
>elements (what about <p> and conflict resolution with
>--drop-empty-paras?). The desired behaivour for 'auto' in cases like
><abbr title=''></abbr> or <div>...<div></div>...</div> probably needs
>some discussion.
>
> >Also, I find it very curious that you can use a DIV to position objects not
> >contained within.
>
>You can't.
Received on Tuesday, 17 December 2002 11:52:51 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:39:48 UTC