Commit c4d1975d authored by abarth@webkit.org's avatar abarth@webkit.org

2011-05-12 Adam Barth <abarth@webkit.org>

        Reviewed by Darin Adler.

        REGRESSION (r65868): createContextualFragment does not work with <style>
        https://bugs.webkit.org/show_bug.cgi?id=60155

        These test results match Firefox.

        * fast/parser/style-in-create-contextual-fragment-expected.txt: Added.
        * fast/parser/style-in-create-contextual-fragment-head-expected.txt: Added.
        * fast/parser/style-in-create-contextual-fragment-head.html: Added.
        * fast/parser/style-in-create-contextual-fragment.html: Added.
2011-05-12  Adam Barth  <abarth@webkit.org>

        Reviewed by Darin Adler.

        REGRESSION (r65868): createContextualFragment does not work with <style>
        https://bugs.webkit.org/show_bug.cgi?id=60155

        createContextualFragment doesn't have a spec, so it's hard to tell what
        we're supposed to do exactly.  This patch appears to make our behavior
        more like Firefox and should fix the compat issue with this site.

        Tests: fast/parser/style-in-create-contextual-fragment-head.html
               fast/parser/style-in-create-contextual-fragment.html

        * dom/Element.cpp:
        (WebCore::Element::deprecatedCreateContextualFragment):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86364 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2f975c92
2011-05-12 Adam Barth <abarth@webkit.org>
Reviewed by Darin Adler.
REGRESSION (r65868): createContextualFragment does not work with <style>
https://bugs.webkit.org/show_bug.cgi?id=60155
These test results match Firefox.
* fast/parser/style-in-create-contextual-fragment-expected.txt: Added.
* fast/parser/style-in-create-contextual-fragment-head-expected.txt: Added.
* fast/parser/style-in-create-contextual-fragment-head.html: Added.
* fast/parser/style-in-create-contextual-fragment.html: Added.
2011-05-12 David Grogan <dgrogan@chromium.org>
Reviewed by Nate Chapin.
| <html>
| <head>
| <script>
| src="../../resources/dump-as-markup.js"
| "
"
| <body>
| "
"
| <script>
| "
var range = document.createRange();
range.selectNode(document.body);
var documentFragment = range.createContextualFragment("<title>hi</title><style></style><body>XXX<div>ttt</div></body>");
document.body.appendChild(documentFragment);
"
| <title>
| "hi"
| <style>
| "XXX"
| <div>
| "ttt"
| "
"
| <html>
| <head>
| <script>
| src="../../resources/dump-as-markup.js"
| "
"
| <title>
| "hi"
| <style>
| "XXX"
| <div>
| "ttt"
| <body>
| "
"
| <script>
| "
var range = document.createRange();
range.selectNode(document.head);
var documentFragment = range.createContextualFragment("<title>hi</title><style></style><body>XXX<div>ttt</div></body>");
document.head.appendChild(documentFragment);
"
| "
"
<script src="../../resources/dump-as-markup.js"></script>
<body>
<script>
var range = document.createRange();
range.selectNode(document.head);
var documentFragment = range.createContextualFragment("<title>hi</title><style></style><body>XXX<div>ttt</div></body>");
document.head.appendChild(documentFragment);
</script>
</body>
<script src="../../resources/dump-as-markup.js"></script>
<body>
<script>
var range = document.createRange();
range.selectNode(document.body);
var documentFragment = range.createContextualFragment("<title>hi</title><style></style><body>XXX<div>ttt</div></body>");
document.body.appendChild(documentFragment);
</script>
</body>
2011-05-12 Adam Barth <abarth@webkit.org>
Reviewed by Darin Adler.
REGRESSION (r65868): createContextualFragment does not work with <style>
https://bugs.webkit.org/show_bug.cgi?id=60155
createContextualFragment doesn't have a spec, so it's hard to tell what
we're supposed to do exactly. This patch appears to make our behavior
more like Firefox and should fix the compat issue with this site.
Tests: fast/parser/style-in-create-contextual-fragment-head.html
fast/parser/style-in-create-contextual-fragment.html
* dom/Element.cpp:
(WebCore::Element::deprecatedCreateContextualFragment):
2011-05-12 Ryosuke Niwa <rniwa@webkit.org>
Reviewed by Darin Adler.
......@@ -154,7 +154,7 @@ PassRefPtr<DocumentFragment> Element::deprecatedCreateContextualFragment(const S
RefPtr<Node> nextNode;
for (RefPtr<Node> node = fragment->firstChild(); node; node = nextNode) {
nextNode = node->nextSibling();
if (node->hasTagName(htmlTag) || node->hasTagName(bodyTag)) {
if (node->hasTagName(htmlTag) || node->hasTagName(headTag) || node->hasTagName(bodyTag)) {
HTMLElement* element = toHTMLElement(node.get());
Node* firstChild = element->firstChild();
if (firstChild)
......@@ -169,14 +169,11 @@ PassRefPtr<DocumentFragment> Element::deprecatedCreateContextualFragment(const S
}
fragment->removeChild(element, ignoredExceptionCode);
ASSERT(!ignoredExceptionCode);
} else if (node->hasTagName(headTag)) {
fragment->removeChild(node.get(), ignoredExceptionCode);
ASSERT(!ignoredExceptionCode);
}
}
return fragment.release();
}
PassRefPtr<Node> Element::cloneNode(bool deep)
{
return deep ? cloneElementWithChildren() : cloneElementWithoutChildren();
......
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