Closed Bug 312104 Opened 19 years ago Closed 19 years ago

Some HTML entities are not parsed inside textarea when the semicolon is omitted

Categories

(Core :: DOM: HTML Parser, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: uriber, Assigned: mrbkap)

References

Details

(Keywords: regression, testcase)

Attachments

(2 files)

Usually (at least in quirks mode), the HTML parser recognizes HTML named
entitities even when the final semicolon is omitted (e.g., "&quot").
However, inside a textarea, this is no longer true for some entities. While it
still works for basic XML and "Latin-1" entities, other entities are not
recognized and are displayed literally.

This regressed sometime between 2004-11-10 and 2004-12-19. I'm suspecting bug 88952.

Testcase coming up.
Attached file testcase
IE seems to have the same behavior as us on this testcase (except that in the
pre case, the 4th line is the same as in the textarea). The trivial workaround
is to use semicolons on your entities (as is suggested by the HTML spec and
totally cross-browser compatible) I'm not sure there's a bug here.
Every couple of weeks, I have to explain to someone that just because IE treats
&yen2000 as the equivalent of ¥2000 doesn't mean it's correct. If we are
going to follow SGML rules except for some things in textareas, may I please
have an explanation I can add on to that lecture, about why the rules differ for
only one of HTML's three sets of character entity references, but only in textareas?

(fwliw, Opera 8.5 treats all 8 lines as character entity references, and
replaces them all, "correctly")
Sigh. I'm basically convinced. This should be a simple patch.
Priority: -- → P4
Target Milestone: --- → mozilla1.9alpha
Status: NEW → ASSIGNED
OS: MacOS X → All
Hardware: Macintosh → All
Attached patch Fix textareasSplinter Review
This fixes the textarea case while leaving attributes with the old, compatible behavior.
Attachment #201698 - Flags: review?(bzbarsky)
Comment on attachment 201698 [details] [diff] [review]
Fix textareas

>Index: parser/htmlparser/src/nsHTMLTokens.cpp
>@@ -139,41 +141,46 @@ nsresult ConsumeEntity(nsScannerSharedSu
>+ *  @param   aIECompatEntities IE treats entities with values > 255 as
>+ *                             entities only if their terminated with a

"they are terminated"

Also, add aIECompatible to the comments on ConsumeEntity?
Attachment #201698 - Flags: review?(bzbarsky) → review+
Attachment #201698 - Flags: superreview?(brendan)
Comment on attachment 201698 [details] [diff] [review]
Fix textareas

Is IE just doing what Netscape did?  A minor matter, affecting only that PRBool argument ;-).

/be
Attachment #201698 - Flags: superreview?(brendan) → superreview+
Fix checked in. According to code comments, Netscape 4.x didn't respect these entities with or without the terminating semicolon, so we truely are being compatible with IE.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: