textarea on xexprs are being incorrected written as self-terminating #173

Closed
racket-bug-submit opened this Issue Mar 16, 2012 · 5 comments

2 participants

@racket-bug-submit
Collaborator
Originally submitted by Danny Yoo on: Fri Jan 20 18:20:01 -0500 2012
I tried something like this:

;;;;;;;;;;;;;;;;;;;;;;;;;
    #lang racket/base
    (require xml)
    (xexpr->string
      `(html (head (title "Compiler"))
             (body
              (h1 "Write a program")
              (form 
               (textarea ((id "program")
                          (rows "80")
                          (cols "5")))))))
;;;;;;;;;;;;;;;;;;;;;;;;;

What comes out of this does not look well-formed.

"Compiler

Write a program

</form></body></html>"</p> <p>textarea is not supposed to be a self-terminating tag: most web browsers will not parse it as intended.</p> <h5>Release:</h5> <pre><code>5.2.1 </code></pre> <h5>Environment:</h5> <pre><code>Linux i686 / Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.124 Safari/534.30 </code></pre> <h6>This bug was converted from Gnats bug <a href="http://bugs.racket-lang.org/old/12502">12502</a>.</h6> <p>[anon-submit; dyoo at hashcollision dot org]</p>
@racket-bug-submit
Collaborator
On Fri, 20 Jan 2012 21:52:13 -0500, jay classified this bug as not-a-bug

HTML is not XML. Xexprs represent XML, not HTML. When you
use XML for HTML, it is not the XML that is incorrect, it is
your use of it. In this case, you can give an empty string
as the body of the tag: (textarea "") and the closing tag
will be given, or use the empty-tag-shorthand export from
XML. In fact, there is a FAQ entry on exactly this issue:
http://docs.racket-lang.org/web-server/faq.html?q=faq#(part._.My_browser_displays_my_page_strangely__my_.C.S.S_is_ignored__sections_are_missing__etc_)

@samth
Owner
On Sat, 21 Jan 2012 08:51:27 -0500, samth at ccs dot neu dot edu wrote:
I think this response is 100% wrong.  XML is *irrelevant* to modern
web development, and the web server should provide tools that are
useful to web developers, not tools that only appear to be useful, but
in fact cause subtle bugs.  We should fix whatever is needed so that
people stop asking this FAQ.

On Fri, Jan 20, 2012 at 9:52 PM, jay@racket-lang.org wrote:

Class changed from "sw-bug" to "not-a-bug" by jay at Fri, 20 Jan 2012 21:52:13 -0500
Reason>>> HTML is not XML. Xexprs represent XML, not HTML. When you
use XML for HTML, it is not the XML that is incorrect, it is
your use of it. In this case, you can give an empty string
as the body of the tag: (textarea "") and the closing tag
will be given, or use the empty-tag-shorthand export from
XML. In fact, there is a FAQ entry on exactly this issue:
http://docs.racket-lang.org/web-server/faq.html?q=faq#(part._.My_browser_displays_my_page_strangely__my_.C.S.S_is_ignored__sections_are_missing__etc_)

State changed from "open" to "closed" by jay at Fri, 20 Jan 2012 21:52:13 -0500
Reason>>> Not a bug.

View:
 http://bugs.racket-lang.org/query/?cmd=view&pr=12502

@racket-bug-submit
Collaborator
On Sat, 21 Jan 2012 10:30:45 -0500, matthias at ccs dot neu dot edu wrote:
I second Sam's opinion here. 

On Jan 21, 2012, at 8:51 AM, Sam Tobin-Hochstadt wrote:

I think this response is 100% wrong. XML is irrelevant to modern
web development, and the web server should provide tools that are
useful to web developers, not tools that only appear to be useful, but
in fact cause subtle bugs. We should fix whatever is needed so that
people stop asking this FAQ.

On Fri, Jan 20, 2012 at 9:52 PM, jay@racket-lang.org wrote:

Class changed from "sw-bug" to "not-a-bug" by jay at Fri, 20 Jan 2012 21:52:13 -0500
Reason>>> HTML is not XML. Xexprs represent XML, not HTML. When you
use XML for HTML, it is not the XML that is incorrect, it is
your use of it. In this case, you can give an empty string
as the body of the tag: (textarea "") and the closing tag
will be given, or use the empty-tag-shorthand export from
XML. In fact, there is a FAQ entry on exactly this issue:
http://docs.racket-lang.org/web-server/faq.html?q=faq#(part._.My_browser_displays_my_page_strangely__my_.C.S.S_is_ignored__sections_are_missing__etc_)

State changed from "open" to "closed" by jay at Fri, 20 Jan 2012 21:52:13 -0500
Reason>>> Not a bug.

View:
http://bugs.racket-lang.org/query/?cmd=view&pr=12502

sam th
samth@ccs.neu.edu

@racket-bug-submit
Collaborator
On Sat, 21 Jan 2012 10:52:16 -0500, eli at barzilay dot org wrote:
--f46d042f91181ffbba04b70bc894
Content-Type: text/plain; charset=UTF-8

On Saturday, January 21, 2012, Sam Tobin-Hochstadt <samth@ccs.neu.edu>
wrote:
> I think this response is 100% wrong.  XML is *irrelevant* to modern
> web development, and the web server should provide tools that are
> useful to web developers, not tools that only appear to be useful, but
> in fact cause subtle bugs.  We should fix whatever is needed so that
> people stop asking this FAQ.

I think that it's more than that: IIRC, a textare is not one of the tags
that is allowed to be empty.  (When I did the bindings for the
scribble/html language I went over the DTDs, and I made it always have a
closing tag.)

 -- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

--f46d042f91181ffbba04b70bc894
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Saturday, January 21, 2012, Sam Tobin-Hochstadt &lt;<a href=3D"mailto:sa=
mth@ccs.neu.edu">samth@ccs.neu.edu</a>&gt; wrote:<br>&gt; I think this resp=
onse is 100% wrong. =C2=A0XML is *irrelevant* to modern<br>&gt; web develop=
ment, and the web server should provide tools that are<br>
&gt; useful to web developers, not tools that only appear to be useful, but=
<br>&gt; in fact cause subtle bugs. =C2=A0We should fix whatever is needed =
so that<br>&gt; people stop asking this FAQ.<br><br>I think that it&#39;s m=
ore than that: IIRC, a textare is not one of the tags that is allowed to be=
 empty. =C2=A0(When I did the bindings for the scribble/html language I wen=
t over the DTDs, and I made it always have a closing tag.)<br>
<br>-- <br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ((lambda (x) (x x)) (lambda (=
x) (x x)))=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Eli Barzilay:<br>=C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 <a href=3D"http://www.bar=
zilay.org/">http://www.barzilay.org/</a>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0=C2=A0 Maze is Life!<br>

--f46d042f91181ffbba04b70bc894--
@racket-bug-submit
Collaborator
On Sat, 21 Jan 2012 11:01:51 -0500, matthias at ccs dot neu dot edu wrote:
--Apple-Mail-4-962161085
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
    charset=us-ascii

The discussion has been taken off-line. 

(As for the strictly technical sense, your reply is wrong. Please re-read Jay's response.)

On Jan 21, 2012, at 10:52 AM, Eli Barzilay wrote:

On Saturday, January 21, 2012, Sam Tobin-Hochstadt samth@ccs.neu.edu wrote:

I think this response is 100% wrong. XML is irrelevant to modern
web development, and the web server should provide tools that are
useful to web developers, not tools that only appear to be useful, but
in fact cause subtle bugs. We should fix whatever is needed so that
people stop asking this FAQ.

I think that it's more than that: IIRC, a textare is not one of the tags that is allowed to be empty. (When I did the bindings for the scribble/html language I went over the DTDs, and I made it always have a closing tag.)

      ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
              http://www.barzilay.org/                 Maze is Life!
--Apple-Mail-4-962161085
Content-Transfer-Encoding: 7bit
Content-Type: text/html;
    charset=us-ascii


The discussion has been taken off-line. 

(As for the strictly technical sense, your reply is wrong. Please re-read Jay's response.) 


On Jan 21, 2012, at 10:52 AM, Eli Barzilay wrote:

On Saturday, January 21, 2012, Sam Tobin-Hochstadt <samth@ccs.neu.edu> wrote:
> I think this response is 100% wrong.  XML is irrelevant to modern
> web development, and the web server should provide tools that are

> useful to web developers, not tools that only appear to be useful, but
> in fact cause subtle bugs.  We should fix whatever is needed so that
> people stop asking this FAQ.

I think that it's more than that: IIRC, a textare is not one of the tags that is allowed to be empty.  (When I did the bindings for the scribble/html language I went over the DTDs, and I made it always have a closing tag.)


--
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!



--Apple-Mail-4-962161085--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment