Closed Bug 170413 Opened 23 years ago Closed 23 years ago

User-defined elements are all created as children of the <head>

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 167493

People

(Reporter: rbs, Assigned: jesup)

References

Details

(Keywords: regression)

This is a regression from bug 167493. This patch used for that bug had some issues. I traced what goes on when a user-defined tag is outside the <HEAD> and saw something strange happening. Suppose <MyElement> is inside the <BODY> instead of the <HEAD>. The code will roll into HandleStartToken() and do what I illustrate below (traced in the debugger): nsresult CNavDTD::HandleStartToken(CToken* aToken) { [...] //XXXrbs const nsAString& tag = ((CStartToken*)aToken)->GetStringValue(); if (tag.Equals(NS_LITERAL_STRING("myElement"))) NS_BREAK(); PRBool theExclusive=PR_FALSE; theHeadIsParent=nsHTMLElement::IsChildOfHead(theChildTag,theExclusive); >>>with the patch, this *always* returns |theHeadIsParent=true| for a >>>user-defined tag [...] #if 0 //we'll move to this approach after beta... if(!isTokenHandled) { if(theHeadIsParent && (theExclusive || mOpenHeadCount>0)) { result=AddHeadLeaf(theNode); } else result=HandleDefaultStartToken(aToken,theChildTag,theNode); } #else //the old way... if(!isTokenHandled) { if(theHeadIsParent || (mOpenHeadCount>0 && (eHTMLTag_newline==theChildTag || eHTMLTag_whitespace==theChildTag))) { result=AddHeadLeaf(theNode); >>>since |theHeadIsParent| is true, the smippet above >>>will *always* add userdefined as a _leaf_ of the head } else result=HandleDefaultStartToken(aToken,theChildTag,theNode); } #endif //now do any post processing necessary on the tag... if(NS_OK==result) DidHandleStartTag(*theNode,theChildTag); }//if } //if [...] }
-> re-assigning to rjesup who handled bug 167493.
Assignee: harishd → rjesup
Depends on: 167493
Keywords: regression
Duping to bug 167493; all the discussion is there. I'm going to back the patch out until we can figure out a solution. *** This bug has been marked as a duplicate of 167493 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
*** Bug 171324 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.