Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#1203 closed defect (wontfix)

RE: Ticket #1196 - Ampersands in PRE tags - Improper assumption about HTML Rendering

Reported by: guest Owned by:
Priority: normal Milestone: 0.96
Component: HTML Output Version: trunk
Severity: normal Keywords:


I am posting to encourage the developers to reconsider the entitization of ampersands contained within PRE tags. I posted a previous ticket (#1196) which was closed, but I believe this closure was based on improper assumptions. First of all, ampersands within PRE tags are directly rendered, meaning that any entitization will be shown printed on screen as it is written in the source, which will completely mess up any display of code snippets. It does not make sense to insist that entitization is correct in this case, as it undermines the purpose of the PRE tag, which instructs the browser to do its best to display special characters without using html entities.

This is not a behavior of Drupal when using Xinha as an embedded editor, as the transformation of ampersands can be seen in realtime as the Xinha javascript executes and draws the rich-text editor and modifies the pre-existing text area. This is observable also within the Xinha demo hosted on this ( website.

Change History (3)

comment:1 Changed 12 years ago by gogo

  • Resolution set to wontfix
  • Status changed from new to closed

Entization is the correct behaviour, I refer you to the specification:

If you want non-entized data then you could try using a CDATA block.

This is the same misconception people have about <textarea>, lots of people think it's just fine and dandy to do <textarea><h1>Hello</h1></textarea> when in fact that is not fine and dandy at all.

comment:2 Changed 12 years ago by gogo

I also suggest you read wiki:Entize? as it all applies to <pre> also.

comment:3 Changed 12 years ago by ray

I'd be interested to know which browser renders ampersands in pre tags literally as you say.

I've set up a testcase for this under that clearly shows that all recent major browsers do work properly with entities within pre and code tags

Note: See TracTickets for help on using tickets.