Added code to avoid head tag getting closed

on encountering newlines and whitespaces.  This would
prevent script tag, inside head, from opening body tag - made
up body tag.
This commit is contained in:
harishd%netscape.com 1999-03-18 00:22:10 +00:00
parent b39c6dde91
commit 0c6e6332fa
2 changed files with 14 additions and 10 deletions

View File

@ -987,11 +987,13 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
//with any tags that don't belong in the head.
if(NS_OK==result) {
if(mHasOpenHead){
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(aTag)){
CEndToken theToken(eHTMLTag_head);
nsCParserNode theNode(&theToken,mLineNumber);
result=CloseContainer(theNode,eHTMLTag_head,PR_FALSE);
static eHTMLTags skip2[]={eHTMLTag_newline,eHTMLTag_whitespace};
if(!FindTagInSet(aTag,skip2,sizeof(skip2)/sizeof(eHTMLTag_unknown))){
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(aTag)){
CEndToken theToken(eHTMLTag_head);
nsCParserNode theNode(&theToken,mLineNumber);
result=CloseContainer(theNode,eHTMLTag_head,PR_FALSE);
}
}
}
}

View File

@ -987,11 +987,13 @@ nsresult CNavDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsCParserNode
//with any tags that don't belong in the head.
if(NS_OK==result) {
if(mHasOpenHead){
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(aTag)){
CEndToken theToken(eHTMLTag_head);
nsCParserNode theNode(&theToken,mLineNumber);
result=CloseContainer(theNode,eHTMLTag_head,PR_FALSE);
static eHTMLTags skip2[]={eHTMLTag_newline,eHTMLTag_whitespace};
if(!FindTagInSet(aTag,skip2,sizeof(skip2)/sizeof(eHTMLTag_unknown))){
if(!gHTMLElements[eHTMLTag_head].IsChildOfHead(aTag)){
CEndToken theToken(eHTMLTag_head);
nsCParserNode theNode(&theToken,mLineNumber);
result=CloseContainer(theNode,eHTMLTag_head,PR_FALSE);
}
}
}
}