Commit f5bb3016 authored by darin's avatar darin

LayoutTests:

        Reviewed by Darin.

        - Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=7321
        REGRESSION: style tag in body causes two head elements to appear in the DOM

        The head-check.html document uses an iframe as a laboratory for loading each
        head-check-N.html file and checking its DOM, with inspiration from Ian Hixie's
        Live DOM Viewer: http://software.hixie.ch/utilities/js/live-dom-viewer/

        Each of the four head-check-N.html files tests a different code path for
        creating a document's head element in WebCore/khtml/html/htmlparser.cpp.

        * editing/inserting/editing-empty-divs-expected.txt: Corrected <html> child
        index for <body> since the document previously had two <head> nodes.
        * fast/dom/HTMLHeadElement: Added.
        * fast/dom/HTMLHeadElement/head-check-expected.txt: Added.
        * fast/dom/HTMLHeadElement/head-check.html: Added.
        * fast/dom/HTMLHeadElement/resources: Added.
        * fast/dom/HTMLHeadElement/resources/head-check-1.html: Added.
        * fast/dom/HTMLHeadElement/resources/head-check-2.html: Added.
        * fast/dom/HTMLHeadElement/resources/head-check-3.html: Added.
        * fast/dom/HTMLHeadElement/resources/head-check-4.html: Added.
        * fast/dom/HTMLHeadElement/resources/head-check.js: Added.

WebCore:

        Reviewed by Darin.

        - Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=7321
        REGRESSION: style tag in body causes two head elements to appear in the DOM

        * khtml/html/htmlparser.cpp: Handle the head node like form and map nodes.
        (WebCore::HTMLParser::parseToken):
        (WebCore::HTMLParser::headCreateErrorCheck):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@13044 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 81bb3dc6
2006-02-27 David Kilzer <ddkilzer@kilzer.net>
Reviewed by Darin.
- Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=7321
REGRESSION: style tag in body causes two head elements to appear in the DOM
The head-check.html document uses an iframe as a laboratory for loading each
head-check-N.html file and checking its DOM, with inspiration from Ian Hixie's
Live DOM Viewer: http://software.hixie.ch/utilities/js/live-dom-viewer/
Each of the four head-check-N.html files tests a different code path for
creating a document's head element in WebCore/khtml/html/htmlparser.cpp.
* editing/inserting/editing-empty-divs-expected.txt: Corrected <html> child
index for <body> since the document previously had two <head> nodes.
* fast/dom/HTMLHeadElement: Added.
* fast/dom/HTMLHeadElement/head-check-expected.txt: Added.
* fast/dom/HTMLHeadElement/head-check.html: Added.
* fast/dom/HTMLHeadElement/resources: Added.
* fast/dom/HTMLHeadElement/resources/head-check-1.html: Added.
* fast/dom/HTMLHeadElement/resources/head-check-2.html: Added.
* fast/dom/HTMLHeadElement/resources/head-check-3.html: Added.
* fast/dom/HTMLHeadElement/resources/head-check-4.html: Added.
* fast/dom/HTMLHeadElement/resources/head-check.js: Added.
2006-02-27 Justin Garcia <justin.garcia@apple.com>
Reviewed by darin
......
This test checks whether one (and only one) HEAD element is created for various HTML documents. See Bug 7321 REGRESSION: style tag in body causes two head elements to appear in the DOM.
Testing: head-check-1.html
PASS iframe.contentWindow.document.getElementsByTagName('head').length is 1
PASS iframe.contentWindow.document.firstChild.firstChild.nodeName.toLowerCase() is 'head'
Testing: head-check-2.html
PASS iframe.contentWindow.document.getElementsByTagName('head').length is 1
PASS iframe.contentWindow.document.firstChild.firstChild.nodeName.toLowerCase() is 'head'
Testing: head-check-3.html
PASS iframe.contentWindow.document.getElementsByTagName('head').length is 1
PASS iframe.contentWindow.document.firstChild.firstChild.nodeName.toLowerCase() is 'head'
Testing: head-check-4.html
PASS iframe.contentWindow.document.getElementsByTagName('head').length is 1
PASS iframe.contentWindow.document.firstChild.firstChild.nodeName.toLowerCase() is 'head'
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<link rel="stylesheet" href="../../js/resources/js-test-style.css">
<script src="../../js/resources/js-test-pre.js"></script>
<script src="resources/head-check.js"></script>
</head>
<body>
<p id="description">
This test checks whether one (and only one) HEAD element is created for various HTML documents.
See <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7321">Bug 7321</a>
REGRESSION: style tag in body causes two head elements to appear in the DOM.
</p>
<div id="console"></div>
<iframe id="iframe" src="data:text/html," onload="testAndLoadNext()"></iframe>
</body>
</html>
<html><head></head><body><style></style></body></html>
var maxTests = 4;
var currentTest = 1;
var iframe;
if (window.layoutTestController) {
window.layoutTestController.waitUntilDone();
}
function testAndLoadNext() {
iframe = document.getElementById("iframe");
if (iframe.src.substring(0, 5) == "data:") {
iframe.src = "resources/head-check-" + currentTest + ".html";
return;
}
debug("Testing: " + iframe.src.substring(iframe.src.lastIndexOf("/") + 1));
shouldBe("iframe.contentWindow.document.getElementsByTagName('head').length", "1");
shouldBe("iframe.contentWindow.document.firstChild.firstChild.nodeName.toLowerCase()", "'head'");
debug("");
if (currentTest < maxTests) {
currentTest++;
iframe.src = "data:text/html,";
}
else {
iframe.style.display = "none";
debug('<span class="pass">TEST COMPLETE</span>');
if (window.layoutTestController) {
window.layoutTestController.notifyDone();
}
}
}
2006-02-27 David Kilzer <ddkilzer@kilzer.net>
Reviewed by Darin.
- Fix for http://bugzilla.opendarwin.org/show_bug.cgi?id=7321
REGRESSION: style tag in body causes two head elements to appear in the DOM
* khtml/html/htmlparser.cpp: Handle the head node like form and map nodes.
(WebCore::HTMLParser::parseToken):
(WebCore::HTMLParser::headCreateErrorCheck):
2006-02-27 Eric Seidel <eseidel@apple.com>
Reviewed by darin.
......
......@@ -231,7 +231,10 @@ PassRefPtr<NodeImpl> HTMLParser::parseToken(Token *t)
if (form == n)
form = 0;
if (head == n)
head = 0;
return 0;
}
return n;
......@@ -607,7 +610,11 @@ bool HTMLParser::commentCreateErrorCheck(Token* t, RefPtr<NodeImpl>& result)
bool HTMLParser::headCreateErrorCheck(Token* t, RefPtr<NodeImpl>& result)
{
return (!head || current->localName() == htmlTag);
if (!head || current->localName() == htmlTag) {
head = new HTMLHeadElementImpl(document);
result = head;
}
return false;
}
bool HTMLParser::bodyCreateErrorCheck(Token* t, RefPtr<NodeImpl>& result)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment