98187 - Make sure that the end tag, inline element, does not close tags in the root tag list. r=heikki,sr-vidur

git-svn-id: svn://10.0.0.236/trunk@103145 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
harishd%netscape.com
2001-09-19 00:01:42 +00:00
parent f8ac63ed7e
commit cecf1d33ee
2 changed files with 10 additions and 4 deletions

View File

@@ -2175,19 +2175,22 @@ eHTMLTags nsHTMLElement::GetCloseTargetForEndTag(nsDTDContext& aContext,PRInt32
// Note: we intentionally make 2 passes:
// The first pass tries to exactly match, the 2nd pass matches the group.
TagList* theRootTags=gHTMLElements[mTagID].GetEndRootTags();
PRInt32 theIndexCopy=theIndex;
while(--theIndex>=anIndex){
eHTMLTags theTag=aContext.TagAt(theIndex);
if(theTag == mTagID) {
return theTag; // we found our target.
}
else if (!CanContain(theTag)) {
else if (!CanContain(theTag) ||
(theRootTags && FindTagInSet(theTag,theRootTags->mTags,theRootTags->mCount))) {
// If you cannot contain this tag then
// you cannot close it either. It looks like
// the tag trying to close is misplaced.
// In the following Exs. notice the misplaced /font:
// Ex. <font><table><tr><td></font></td></tr></table. -- Ref. bug 56245
// Ex. <font><select><option></font></select> -- Ref. bug 37618.
// Ex. <font><select><option></font></select> -- Ref. bug 37618
// Ex. <font><select></font><option></select> -- Ref. bug 98187
return eHTMLTag_unknown;
}
}