Closed
Bug 54651
Opened 24 years ago
Closed 24 years ago
<LI> doesn't allow nested <DIV>s
Categories
(Core :: DOM: HTML Parser, defect, P3)
Core
DOM: HTML Parser
Tracking
()
VERIFIED
FIXED
People
(Reporter: ian, Assigned: rickg)
References
()
Details
(Keywords: testcase, Whiteboard: [rtm++] fix in hand.)
Attachments
(1 file)
789 bytes,
text/html
|
Details |
STEPS TO REPRODUCE:
Pass to the parser:
<UL> <LI> <DIV> text </DIV> </LI> </UL>
...or look at the testcase.
EXPECTED RESULTS:
Parser builds correct content model.
ACTUAL RESULTS:
Parser doesn't allow DIV to be contained in an LI.
This is a SERIOUS problem with our HTML content sink. Recommend rtm hard stop.
It should be an easy, low risk fix if previous such bugs are anything to go by.
Reporter | ||
Comment 1•24 years ago
|
||
Reporter | ||
Comment 2•24 years ago
|
||
Uriel: This is the bug you found with David's childsel test:
http://www.people.fas.harvard.edu/~dbaron/css/test/childsel
Good catch.
Odd -- the LI is set up as a block container. Let's see what's going on...
Status: NEW → ASSIGNED
<UL> <LI> <DIV> text </DIV> </LI> </UL> works perfectly for me.
But this case does not: <DIV><UL><LI><DIV> text </DIV> </LI></UL></DIV>
Let's see why...
Ok -- fixed in my tree. It's an error in the autoclose logic. I'll build a huge
test suite to look for other cases...
Reporter | ||
Comment 6•24 years ago
|
||
Taking QA per managerial policy.
QA Contact: janc → py8ieh=bugzilla
Comment 7•24 years ago
|
||
What sites does this actually break? Marking rtm- until we get information
about user impact.
Whiteboard: [RTM+] fix in hand. → [RTM-] fix in hand.
Comment 8•24 years ago
|
||
We should accept this for RTM. The issue is that this kind of error in the
autoclose logic could cause a wide variety of markup sequences to potentially
break. This is backward compatibility with poorly-formed or nested HTML 3.2 on
the web--there's a great deal of that. We don't have time to go out and do an
exhaustive search of the web to turn up examples of this, but knowing that DIVs
are widely mis-nested, I'd prefer to accept the low-risk patch and sleep soundly
rather than find out the hard way *after* ship how many pages this affects.
Reporter | ||
Comment 9•24 years ago
|
||
PDT, Eric: This is not only a compatability issue. This is an issue with
_CORRECT_ HTML too! As we encourage people to use structural markup, this
markup will become more and more common. It is probably already very common on
the web. As I understand it, parser fixes of this kind are remarkably low risk
and are a _very_ well understood procedure that Rick has done many times before.
Putting back on [rtm+] radar.
Whiteboard: [RTM-] fix in hand. → [rtm+] fix in hand.
Assignee | ||
Comment 10•24 years ago
|
||
Agreed; and this: I'm currently generating an absolutely *HUGE* testset of pages
to try to catch these before we go out. I'll publish more about it once it's
working. : )
Assignee | ||
Comment 11•24 years ago
|
||
Here's the patch:
Index: CNavDTD.cpp
===================================================================
RCS file: /cvsroot/mozilla/htmlparser/src/CNavDTD.cpp,v
retrieving revision 3.317
diff -r3.317 CNavDTD.cpp
983,984c983,988
< PRBool result=PR_TRUE;
< if(aContext.GetCount()){
---
> //the changes to this method were added to fix bug 54651...
>
> PRBool result=PR_TRUE;
> PRInt32 theCount=aContext.GetCount();
>
> if(0<theCount){
991c995
< PRInt32 theBaseIndex=(theRootIndex>theSPIndex) ? theRootIndex :
theSPIndex;
---
> PRInt32 theTargetIndex=(theRootIndex>theSPIndex) ? theRootIndex :
theSPIndex;
993c997,998
< if((theBaseIndex==theChildIndex) &&
(gHTMLElements[aChildTag].CanContainSelf()))
---
> if((theTargetIndex==theCount-1) ||
> ((theTargetIndex==theChildIndex) &&
gHTMLElements[aChildTag].CanContainSelf())) {
995c1000,1018
< else result=PRBool(theBaseIndex>theChildIndex);
---
> }
> else {
>
> result=PR_FALSE;
>
> PRInt32 theIndex=theCount-1;
> while(theChildIndex<theIndex) {
> eHTMLTags theParentTag=aContext.TagAt(theIndex--);
> if (gHTMLElements[theParentTag].IsMemberOf(kBlockEntity) ||
> gHTMLElements[theParentTag].IsMemberOf(kHeading) ||
> gHTMLElements[theParentTag].IsMemberOf(kPreformatted) ||
> gHTMLElements[theParentTag].IsMemberOf(kList)) {
> if(!HasOptionalEndTag(theParentTag)) {
> result=PR_TRUE;
> break;
> }
> }
> }
> }
Comment 12•24 years ago
|
||
Hixie's reasoning seems fairly accurate-if we're trying to get people to do
things differently (our way?) we should at least have something working when they
take us up on the offer.
Assignee | ||
Comment 13•24 years ago
|
||
The code has been reviewed and superreviewed by buster.
Comment 14•24 years ago
|
||
Rick, we collided as I was marking need info :-) [rtm++] since you have the
reviews.
Whiteboard: [rtm+] fix in hand. → [rtm++] fix in hand.
Assignee | ||
Comment 15•24 years ago
|
||
Fixed by small improvement to code that allows a child container to veto
containment in a parent.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Comment 16•24 years ago
|
||
Verified Fixed on trunk builds testcase was Green
linux 101808 RedHat 6.2
win32 101804 NT 4
mac 101804 Mac OS9
Setting bug to Verified and removing vtrunk keyword
Status: RESOLVED → VERIFIED
Keywords: vtrunk
You need to log in
before you can comment on or make changes to this bug.
Description
•