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

Re: Empty <div> tags

From: Bjoern Hoehrmann <derhoermi@gmx.net>
Date: Tue, 17 Dec 2002 06:35:00 +0100
To: Charles Reitzel <creitzel@rcn.com>
Cc: html-tidy@w3.org
Message-ID: <3e00a1d0.190232930@smtp.bjoern.hoehrmann.de>

* 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,


Will be cleaned to 




depending of the value given for the mentioned option. Using something
similar in a more general fashion, i.e., for all empty elements, but

<div>...<div style="
  position:         absolute;
  top:              168px;
  left:             0px;
  width:            729px;
  border-top-style: solid;
  border-top-width: 1px;
  border-top-color: #000000;">...</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 00:34:23 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:52 UTC