unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50539: Don't use comment colors in HTML textareas
@ 2021-09-12  6:11 積丹尼 Dan Jacobson
  2021-09-12 18:55 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: 積丹尼 Dan Jacobson @ 2021-09-12  6:11 UTC (permalink / raw)
  To: 50539

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50539: Don't use comment colors in HTML textareas
  2021-09-12  6:11 bug#50539: Don't use comment colors in HTML textareas 積丹尼 Dan Jacobson
@ 2021-09-12 18:55 ` Lars Ingebrigtsen
  2021-09-12 22:05   ` Gregory Heytings
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-12 18:55 UTC (permalink / raw)
  To: 積丹尼 Dan Jacobson; +Cc: 50539

積丹尼 Dan Jacobson <jidanni@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50539: Don't use comment colors in HTML textareas
  2021-09-12 18:55 ` Lars Ingebrigtsen
@ 2021-09-12 22:05   ` Gregory Heytings
  2021-09-13  8:10     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Gregory Heytings @ 2021-09-12 22:05 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 積丹尼 Dan Jacobson, 50539


>
> 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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#50539: Don't use comment colors in HTML textareas
  2021-09-12 22:05   ` Gregory Heytings
@ 2021-09-13  8:10     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-13  8:10 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: 積丹尼 Dan Jacobson, 50539

Gregory Heytings <gregory@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





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-13  8:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-12  6:11 bug#50539: Don't use comment colors in HTML textareas 積丹尼 Dan Jacobson
2021-09-12 18:55 ` Lars Ingebrigtsen
2021-09-12 22:05   ` Gregory Heytings
2021-09-13  8:10     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).