GNU bug report logs - #50539
Don't use comment colors in HTML textareas

Previous Next

Package: emacs;

Reported by: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>

Date: Sun, 12 Sep 2021 06:23:01 UTC

Severity: minor

Tags: moreinfo, notabug

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50539 in the body.
You can then email your comments to 50539 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#50539; Package emacs. (Sun, 12 Sep 2021 06:23:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 12 Sep 2021 06:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
To: bug-gnu-emacs <at> gnu.org
Subject: Don't use comment colors in HTML textareas
Date: Sun, 12 Sep 2021 14:11:25 +0800
Here emacs misleads the user via comment color,
into thinking that the so-called comment is still
a comment in an HTML textarea:

$ emacs some.html
 <form>
  <p>
  <textarea readonly="1">Ralph is tall.
<!-- He's cute. -->
</textarea>
  </p>
 </form>

When in fact it gets rendered by browsers.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50539; Package emacs. (Sun, 12 Sep 2021 18:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 50539 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Cc: 50539 <at> debbugs.gnu.org
Subject: Re: bug#50539: Don't use comment colors in HTML textareas
Date: Sun, 12 Sep 2021 20:55:28 +0200
積丹尼 Dan Jacobson <jidanni <at> jidanni.org> writes:

> Here emacs misleads the user via comment color,
> into thinking that the so-called comment is still
> a comment in an HTML textarea:
>
> $ emacs some.html
>  <form>
>   <p>
>   <textarea readonly="1">Ralph is tall.
> <!-- He's cute. -->
> </textarea>
>   </p>
>  </form>
>
> When in fact it gets rendered by browsers.

It gets rendered, but I'm not sure what the actual definition here is.

https://www.w3.org/TR/html401/interact/forms.html#h-17.7

says that the contents of <textarea> is PCDATA (parsed character data),
so for that to be rendered that way by browsers, it should be something
like:

<textarea readonly="1">Ralph is tall.
&lt;!-- He's cute. --&gt;
</textarea>

But browsers use pretty sloppy parsers, and does a lot of DWIM.

libxml2 does parse that as a textarea containing a comment.

I spent a couple minutes to say whether there's any standard that says
whether <!-- comments are allowed in PCDATA or not, but I'd assume so.
Does anybody know for sure?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) moreinfo. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 12 Sep 2021 18:56:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50539; Package emacs. (Sun, 12 Sep 2021 22:06:02 GMT) Full text and rfc822 format available.

Message #13 received at 50539 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 50539 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#50539: Don't use comment colors in HTML textareas
Date: Sun, 12 Sep 2021 22:05:08 +0000
>
> I spent a couple minutes to say whether there's any standard that says 
> whether <!-- comments are allowed in PCDATA or not, but I'd assume so. 
> Does anybody know for sure?
>

I'm not absolutely sure, but AFAIK all HTML tags are rendered as is in a 
text area, not only <!-- comments.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#50539; Package emacs. (Mon, 13 Sep 2021 08:12:01 GMT) Full text and rfc822 format available.

Message #16 received at 50539 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 50539 <at> debbugs.gnu.org,
 積丹尼 Dan Jacobson <jidanni <at> jidanni.org>
Subject: Re: bug#50539: Don't use comment colors in HTML textareas
Date: Mon, 13 Sep 2021 10:10:56 +0200
Gregory Heytings <gregory <at> heytings.org> writes:

>> I spent a couple minutes to say whether there's any standard that
>> says whether <!-- comments are allowed in PCDATA or not, but I'd
>> assume so. Does anybody know for sure?
>
> I'm not absolutely sure, but AFAIK all HTML tags are rendered as is in
> a text area, not only <!-- comments.

Firefox does that:

<textarea>
<p>
</textarea>

But not for

<textarea>
</textarea>
</textarea>

:-)

But, like I said, the contents here are defined to be PCDATA, so this is
just Firefox (and probably Chrome, too) just being generous and trying
to interpret as they guess the writer intended.

HTML-mode also highlights the <p> as if it's a tag...  which it is,
even if Firefox doesn't interpret it as such.

So I think, on the whole, that html-mode does everything correctly here,
and I'm closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) notabug. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 13 Sep 2021 08:12:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 50539 <at> debbugs.gnu.org and 積丹尼 Dan Jacobson <jidanni <at> jidanni.org> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Mon, 13 Sep 2021 08:12:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 11 Oct 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 269 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.