diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp index daf80918edfd..8f6e1a005021 100644 --- a/parser/htmlparser/src/CNavDTD.cpp +++ b/parser/htmlparser/src/CNavDTD.cpp @@ -622,7 +622,9 @@ CNavDTD::HandleToken(CToken* aToken, nsIParser* aParser) PRBool isExclusive = PR_FALSE; PRBool theChildBelongsInHead = gHTMLElements[eHTMLTag_head].IsChildOfHead(theTag, isExclusive); - if (theChildBelongsInHead && !isExclusive) { + if (theChildBelongsInHead && + !isExclusive && + !gHTMLElements[theTag].HasSpecialProperty(kPreferHead)) { if (mMisplacedContent.GetSize() == 0 && (!gHTMLElements[theTag].HasSpecialProperty(kPreferBody) || (mFlags & NS_DTD_FLAG_HAS_EXPLICIT_HEAD))) { diff --git a/parser/htmlparser/src/nsElementTable.cpp b/parser/htmlparser/src/nsElementTable.cpp index a5bce5d800ff..e2e78da1e01b 100644 --- a/parser/htmlparser/src/nsElementTable.cpp +++ b/parser/htmlparser/src/nsElementTable.cpp @@ -790,8 +790,8 @@ const nsHTMLElement gHTMLElements[] = { /*req-parent excl-parent*/ eHTMLTag_unknown,eHTMLTag_unknown, /*rootnodes,endrootnodes*/ &gInHead,&gInHead, /*autoclose starttags and endtags*/ 0,0,0,0, - /*parent,incl,exclgroups*/ kHeadContent, kNone, kNone, - /*special props, prop-range*/ kNonContainer,kDefaultPropRange, + /*parent,incl,exclgroups*/ kAllTags - kHeadContent, kNone, kNone, + /*special props, prop-range*/ kNonContainer|kPreferHead,kDefaultPropRange, /*special parents,kids,skip*/ &gInHead,0,eHTMLTag_unknown, /*contain-func*/ 0 }, @@ -1089,7 +1089,7 @@ const nsHTMLElement gHTMLElements[] = { /*rootnodes,endrootnodes*/ &gRootTags,&gRootTags, /*autoclose starttags and endtags*/ 0,0,0,0, /*parent,incl,exclgroups*/ kAllTags - kHeadContent, kCDATA, kNone, - /*special props, prop-range*/ kNoStyleLeaksIn, kNoPropRange, + /*special props, prop-range*/ kNoStyleLeaksIn|kPreferHead, kNoPropRange, /*special parents,kids,skip*/ 0,0,eHTMLTag_unknown, /*contain-func*/ 0 }, diff --git a/parser/htmlparser/src/nsElementTable.h b/parser/htmlparser/src/nsElementTable.h index 5afc9d5dcb16..5665d26c1f4f 100644 --- a/parser/htmlparser/src/nsElementTable.h +++ b/parser/htmlparser/src/nsElementTable.h @@ -272,5 +272,6 @@ static const int kNonContainer = 0x0200; //If set, then this tag is not a co static const int kHandleStrayTag = 0x0400; //If set, we automatically open a start tag static const int kRequiresBody = 0x0800; //If set, then in case of no BODY one will be opened up immediately. static const int kVerifyHierarchy = 0x1000; //If set, check to see if the tag is a child or a sibling.. +static const int kPreferHead = 0x2000; //This kHeadMisc tag prefers to be in the head if there isn't an explicit #endif diff --git a/parser/htmlparser/tests/mochitest/Makefile.in b/parser/htmlparser/tests/mochitest/Makefile.in index 5eebcdee1ace..1c7ef49b279d 100644 --- a/parser/htmlparser/tests/mochitest/Makefile.in +++ b/parser/htmlparser/tests/mochitest/Makefile.in @@ -53,7 +53,7 @@ _TEST_FILES = parser_datreader.js \ test_html5_tree_construction.html \ test_bug339350.xhtml \ test_bug358797.html \ - bug379025.txt \ + regressions.txt \ $(NULL) libs:: $(_TEST_FILES) diff --git a/parser/htmlparser/tests/mochitest/bug379025.txt b/parser/htmlparser/tests/mochitest/bug379025.txt deleted file mode 100644 index df454f2ecd6f..000000000000 --- a/parser/htmlparser/tests/mochitest/bug379025.txt +++ /dev/null @@ -1,10 +0,0 @@ -#data - -#errors -#document -| -| -| -|