equal
deleted
inserted
replaced
378 } else |
378 } else |
379 return false; |
379 return false; |
380 } |
380 } |
381 } else if (h->hasLocalName(htmlTag)) { |
381 } else if (h->hasLocalName(htmlTag)) { |
382 if (!current->isDocumentNode() ) { |
382 if (!current->isDocumentNode() ) { |
383 if (document->documentElement()->hasTagName(htmlTag)) { |
383 if (document->documentElement()->hasTagName(htmlTag) && !m_isParsingFragment) { |
384 reportError(RedundantHTMLBodyError, &localName); |
384 reportError(RedundantHTMLBodyError, &localName); |
385 // we have another <HTML> element.... apply attributes to existing one |
385 // we have another <HTML> element.... apply attributes to existing one |
386 // make sure we don't overwrite already existing attributes |
386 // make sure we don't overwrite already existing attributes |
387 NamedAttrMap* map = static_cast<Element*>(n)->attributes(true); |
387 NamedAttrMap* map = static_cast<Element*>(n)->attributes(true); |
388 Element* existingHTML = static_cast<Element*>(document->documentElement()); |
388 Element* existingHTML = static_cast<Element*>(document->documentElement()); |
420 if (inBody) { |
420 if (inBody) { |
421 setSkipMode(h->tagQName()); |
421 setSkipMode(h->tagQName()); |
422 return false; |
422 return false; |
423 } |
423 } |
424 } else if (h->hasLocalName(bodyTag)) { |
424 } else if (h->hasLocalName(bodyTag)) { |
425 if (inBody && document->body()) { |
425 if (inBody && document->body() && !m_isParsingFragment) { |
426 // we have another <BODY> element.... apply attributes to existing one |
426 // we have another <BODY> element.... apply attributes to existing one |
427 // make sure we don't overwrite already existing attributes |
427 // make sure we don't overwrite already existing attributes |
428 // some sites use <body bgcolor=rightcolor>...<body bgcolor=wrongcolor> |
428 // some sites use <body bgcolor=rightcolor>...<body bgcolor=wrongcolor> |
429 reportError(RedundantHTMLBodyError, &localName); |
429 reportError(RedundantHTMLBodyError, &localName); |
430 NamedAttrMap* map = static_cast<Element*>(n)->attributes(true); |
430 NamedAttrMap* map = static_cast<Element*>(n)->attributes(true); |
675 popBlock(bodyTag); |
675 popBlock(bodyTag); |
676 // ### actually for IE document.body returns the now hidden "body" element |
676 // ### actually for IE document.body returns the now hidden "body" element |
677 // we can't implement that behaviour now because it could cause too many |
677 // we can't implement that behaviour now because it could cause too many |
678 // regressions and the headaches are not worth the work as long as there is |
678 // regressions and the headaches are not worth the work as long as there is |
679 // no site actually relying on that detail (Dirk) |
679 // no site actually relying on that detail (Dirk) |
680 if (document->body()) |
680 if (document->body() && !m_isParsingFragment) |
681 document->body()->setAttribute(styleAttr, "display:none"); |
681 document->body()->setAttribute(styleAttr, "display:none"); |
682 inBody = false; |
682 inBody = false; |
683 } |
683 } |
684 if ((haveContent || haveFrameSet) && current->localName() == htmlTag) |
684 if ((haveContent || haveFrameSet) && current->localName() == htmlTag) |
685 return false; |
685 return false; |
1160 elem->node = prevMaxElem->node; |
1160 elem->node = prevMaxElem->node; |
1161 elem->didRefNode = prevMaxElem->didRefNode; |
1161 elem->didRefNode = prevMaxElem->didRefNode; |
1162 prevMaxElem->next = elem; |
1162 prevMaxElem->next = elem; |
1163 ASSERT(newNodePtr); |
1163 ASSERT(newNodePtr); |
1164 prevMaxElem->node = newNodePtr; |
1164 prevMaxElem->node = newNodePtr; |
1165 prevMaxElem->didRefNode = false; |
1165 newNodePtr->ref(); |
|
1166 prevMaxElem->didRefNode = true; |
1166 } else |
1167 } else |
1167 delete elem; |
1168 delete elem; |
1168 } |
1169 } |
1169 |
1170 |
1170 // Step 7: Reopen intermediate inlines, e.g., <b><p><i>Foo</b>Goo</p>. |
1171 // Step 7: Reopen intermediate inlines, e.g., <b><p><i>Foo</b>Goo</p>. |
1390 { |
1391 { |
1391 if (head || !document->documentElement()) |
1392 if (head || !document->documentElement()) |
1392 return; |
1393 return; |
1393 |
1394 |
1394 head = new HTMLHeadElement(document); |
1395 head = new HTMLHeadElement(document); |
|
1396 |
|
1397 if (m_isParsingFragment) |
|
1398 return; |
|
1399 |
1395 HTMLElement* body = document->body(); |
1400 HTMLElement* body = document->body(); |
1396 ExceptionCode ec = 0; |
1401 ExceptionCode ec = 0; |
1397 document->documentElement()->insertBefore(head, body, ec); |
1402 document->documentElement()->insertBefore(head, body, ec); |
1398 if (ec) |
1403 if (ec) |
1399 head = 0; |
1404 head = 0; |