#787 tidy adds whitespace where it is significant (textarea)

closed-out-of-date
nobody
6
2016-02-14
2006-08-01
Anonymous
No

tidy adds whitespace inside textarea and pre tags. This changes the meaning of the document.

If I run tidy on the following:

<textarea>foo</textare>

tidy turns this into:

<textarea>
foo
</textarea>

I've tested these documents with w3m and konqueror. Both ignore the first extra
line break, but the break after foo is inserted into the textarea.

Tidy seems to insert similar whitespace into PRE tags.

Here's my .tidyrc:

doctype: strict
output-xhtml: yes
tidy-mark: no
indent: no
wrap: 0
enclose-text: yes

Thank you, - Jason

jason169@herkamire.com

Discussion

  • Arnaud Desitter

    Arnaud Desitter - 2006-10-25

    Logged In: YES
    user_id=566665

    Please attached a minimal test case.

     
  • Jason Woofenden

    Jason Woofenden - 2007-01-26

    Logged In: YES
    user_id=347078
    Originator: NO

    I'm running tidy as installed by gentoo's htmltidy-5.10.26-r1 ebuild on my ppc box. I ran tidy with no commandline options and no config file on before.html, which output after.html (I'll attach both.)

     
  • Arnaud Desitter

    Arnaud Desitter - 2007-01-26
     
    Attachments
  • Arnaud Desitter

    Arnaud Desitter - 2007-01-26

    Logged In: YES
    user_id=566665
    Originator: NO

    File Added: tidybug_before.html

     
  • Arnaud Desitter

    Arnaud Desitter - 2007-01-26
    • summary: tidy adds whitespace where it is significant --> tidy adds whitespace where it is significant (textarea)
     
  • Arnaud Desitter

    Arnaud Desitter - 2007-01-26

    Logged In: YES
    user_id=566665
    Originator: NO

    See as well: http://tidy.sf.net/issue/1469993

     
  • Arnaud Desitter

    Arnaud Desitter - 2007-01-27
    • status: open --> open-accepted
     
  • Arnaud Desitter

    Arnaud Desitter - 2007-01-28

    Logged In: YES
    user_id=566665
    Originator: NO

    Could you provide a test case for the PRE element where the tidy processed file rendered differently than the original ?

     
  • Jason Woofenden

    Jason Woofenden - 2007-01-29

    Logged In: YES
    user_id=347078
    Originator: NO

    I don't know what the html specs say about this, but firefox appears to ignore one newline at the beginning of a <pre> tag, and one just before the end, but all others are preserved. Tidy adds a newline at the beginning and end, which normally is ignored by firefox (and probably others.) The trouble comes in when the thing inside the PRE tag gets replaced by a value from a script (server-side scripting or javascript.)

    One further note: the PHP engine seems to eat a newline if one follows the php close tag ?>, so it's trickier to demonstrate the significance of the extra newline just before the </pre> tag. It does effect me though. Because I make template files which are valid html, then replace bits of them with variable values from PHP.

    if you run tidy on this:

    <pre>foo</pre>

    you get:

    <pre>
    foo
    </pre>

    Which obviously has two newlines inserted.

    I don't see an "attach" button anywhere on this page. So here's a link to the php script that demonstrates how this tidy bug can make a difference: http://jasonwoof.com/downloads/tidybug_before.php.txt If I see an attach button later I'll use that as well.

    When I view the output of that php script in firefox, the 1 in the right column is lined up with the 2 in the left column. After running tidy on the script, the 1 in the right column is lined up with the 3 in the left column.

     
  • Arnaud Desitter

    Arnaud Desitter - 2007-01-29
     
  • Arnaud Desitter

    Arnaud Desitter - 2007-01-29

    Logged In: YES
    user_id=566665
    Originator: NO

    Jason, you cannot attach any file because you opened this bug report as anonymous.

    Related issue for pre element: http://tidy.sf.net/issue/1542404

    File Added: tidybug_before.php.txt

     
  • Arnaud Desitter

    Arnaud Desitter - 2007-01-30
    • priority: 5 --> 6
     
  • Geoff

    Geoff - 2016-02-14

    Thanks for the report... now long ago... sorry for the delay...

    Tidy source has moved on to https://github.com/htacg/tidy-html5, site to http://www.html-tidy.org/

    Here referring to sf902, sf787, sf740, sf663, and perhaps others...

    Regretably, it seems current tidy still exhibits this/these problems ;=((!

    If you file an issue, together with sample xml/html and config used, maybe one of the current maintainers may take a look again...

    Or if you find, fix, and test the feature in a tidy fork then you can issue a Pull Request

    Tidy needs your support...

    Meantime closing this/these here as out-of-date...

     
  • Geoff

    Geoff - 2016-02-14
    • status: open-accepted --> closed-out-of-date
     

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

Sign up for the SourceForge newsletter:





No, thanks