Closed Bug 11158 Opened 25 years ago Closed 25 years ago

Form problems with HTML entities (textarea & input)

Categories

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

x86
All
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: bergie, Assigned: rickg)

References

()

Details

(Whiteboard: have fix.)

Mozilla lays out HTML entity content in TEXTAREAs and (on Linux) INPUT
TYPE="TEXT"s differently than most other browsers.

When a TEXTAREA contains a HTML entity, most browsers show the character
referenced to in the entity (for example, an ampersand for &). Mozilla
doesn't do this, but rather shows to HTML entity code instead.

This breaks many Web applications where users are able to edit HTML content
with HTML forms, and so is quite severe.

I have tried this with varous Mozilla builds, including most milestone releases
and the latest nightly build (1999080212), and IIRC it has been
present in all of them, in both Windows NT and Linux platforms.

On both of these platforms, HTML entities in SELECTs are displayed correctly,
but Linux version doesn't view INPUT TYPE=TEXTs with HTML entities in it.

The problem is present with both text and numeric entities.

The URL included could work as a simple test case.
Assignee: karnaze → buster
Reassigning to Steve.
INPUT TYPE=TEXTs behave correctly at least on the 19990802?? build for Windows
NT, so there the problem is only with TEXTAREAs.

On Linux, the problem with INPUT TYPE=TEXT remains, based on the 1999080212
build.
Assignee: buster → rickg
Component: HTML Form Controls → Parser
bergie@iki.fi, thanks for the excellent test case!  I think this is a
straightforward parser problem.  The parser is not processing the content of the
text control value attribute through the HTML entity mapping code, though it
seems to be doing so for the contents of <OPTION>.
Set component to Parser, assigned to RickG.
Status: NEW → ASSIGNED
Target Milestone: M10
I know how to fix it, but I'm not going to do so until I get back from vacation.
This is now fixed in my tree, waiting a chance to checkin.

/**
 * Causes the next skipped-content token (if any) to
 * be consumed by this node.
 * @update  gess5/11/98
 * @param   node to consume skipped-content
 * @param   holds the number of skipped content elements encountered
 * @return  Error condition.
 */
nsresult CNavDTD::CollectSkippedContent(nsCParserNode& aNode,PRInt32& aCount) {

  CTokenRecycler* theRecycler=(CTokenRecycler*)mTokenizer->GetTokenRecycler();

  eHTMLTags       theNodeTag=(eHTMLTags)aNode.GetNodeType();

  int aIndex=0;
  int aMax=mSkippedContent.GetSize();
  nsAutoString theTempStr;
  nsAutoString theStr;
  for(aIndex=0;aIndex<aMax;aIndex++){
    CHTMLToken* theNextToken=(CHTMLToken*)mSkippedContent.PopFront();

    eHTMLTokenTypes theTokenType=(eHTMLTokenTypes)theNextToken->GetTokenType();

    if((eHTMLTag_textarea==theNodeTag) && (eToken_entity==theTokenType)) {
      ((CEntityToken*)theNextToken)->TranslateToUnicodeStr(theTempStr);
    }
    else theNextToken->GetSource(theTempStr);

    theStr+=theTempStr;
    theRecycler->RecycleToken(theNextToken);
  }

  aNode.SetSkippedContent(theStr);
  return NS_OK;
}
Whiteboard: have fix.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fixed the core problem, but there is a policy issue left for buster which I'll
write up as a seperate bug.
QA Contact: phillip → desale
Status: RESOLVED → VERIFIED
Verified with 1999-11-29-09.
You need to log in before you can comment on or make changes to this bug.