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

RE: Empty <div> tags

From: Cox, Charlie <ccox@cincom.com>
Date: Tue, 17 Dec 2002 13:58:25 -0500
Message-ID: <399E1F52E73BD41194A800D0B74A08AB01E4DD9D@skipper.cincom.com>
To: "'Charles Reitzel'" <creitzel@rcn.com>, Bjoern Hoehrmann <derhoermi@gmx.net>
Cc: html-tidy@w3.org

The 'empty-elements' option would work for me as I could retain the <div>
tags with the styles defined for them without changing the default behavior
for anyone else.

would it be feasable to use <br><br> when no attributes are on the <div> and
leave as is(or use new option setting) if attributes are there(maybe just
style,class or id)?

btw, this is not my preference for drawing lines on a web page, but rather
the result of a third party utility to convert hundreds of PDFs to HTML
documents. 

one other note: my example is not nested <div> tags(as posted below), but
rather individual <div> tags. i.e.
<body>
	<div style="..."></div>
	<div style="..."></div>
</body>

Charlie Cox

> -----Original Message-----
> From: Charles Reitzel [mailto:creitzel@rcn.com]
> Sent: Tuesday, December 17, 2002 11:57 AM
> To: Bjoern Hoehrmann
> Cc: html-tidy@w3.org
> Subject: Re: Empty <div> tags
> 
> 
> 
> 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 14:02:37 UTC

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