#180 Tidy strips empty StartEndTags even for empty elems


Tidy (April 1, 2002 version) strips out all the IMG tags (claiming they are empty)!

Here is my .tidyrc:

wrap: 64
indent: no
indent-spaces: 4
add-xml-decl: yes
#output-xhtml: yes
break-before-br: yes
clean: yes
logical-emphasis: yes
enclose-text: yes
enclose-block-test: yes

and here is a small example file:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml">
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<img src="unst001s.png" alt="USA flag" />

Run tidy -m on that and the img tag goes away.


  • Anonymous - 2002-04-06
    • milestone: --> Future - all platforms
  • Anonymous - 2002-04-06

    Logged In: YES

    I was able to reproduce your problem with the current (05 Apr
    02) version of Tidy on my platform (without using the -m
    option). I also confirmed the bug didn't occur with the 04
    Aug 00 version on my platform.

    However, where did you get this version of Tidy from? You
    claim it is a April 2002 binary, but the Tidy meta tag says :

    <meta name="generator" content="HTML Tidy, see www.w3.org" />

    which doesn't match the April 2002 source in CVS.

    This may indicate that the HTML source was originally
    processed with older versions of Tidy, although newer
    versions of Tidy are supposed to update the Tidy meta tag to
    the current format (in fact I just verified that it does).

    Maybe you edited the information created by Tidy, for the
    purposes of posting this bug report.

    Otherwise, this indicates your binary was not built from
    current sources (or even sources in the past year; more
    likely a mixture of sources). It makes it hard to support a
    version of Tidy we don't know about.

    What platform are you running Tidy on? Please use "tidy -v"
    and provide more information.

    Uploaded test case to CVS.

  • Klaus Johannes Rusch

    Logged In: YES

    Looks like the XHTML trailing slash in the image tag confuses tidy, this one

    <img src="unst001s.png" alt="USA flag" />

    fails while

    <img src="unst001s.png" alt="USA flag" >

    works okay.

  • Björn Höhrmann

    • assigned_to: nobody --> hoehrmann
    • summary: Tidy strips all the IMG tags out! --> Tidy strips empty StartEndTags even for empty elems
    • status: open --> closed-fixed
  • Björn Höhrmann

    Logged In: YES

    This bug has been introduced by my fix to bug 531964.
    Constructs like <p /> should be trimmed and my fix enabled
    Tidy to do so, by checking whether StartEndTags should be
    trimmed, however, if an element has an empty content model,
    we should not remove it from the tree, this is fixed in


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks