Commit 9caae932 authored by weinig@apple.com's avatar weinig@apple.com

WebCore:

2008-06-21  Sam Weinig  <sam@webkit.org>

        Reviewed by Dan Bernstein.

        Fix for https://bugs.webkit.org/show_bug.cgi?id=19647
        REGRESSION: Problem with extjs (insertAdjacentHTML)

        Test: fast/dynamic/insertAdjacentHTML-allowed-parents.html

        * html/HTMLElement.cpp:
        (WebCore::HTMLElement::insertAdjacentHTML): Don't use innerHTML logic for creating
        the DocumentFragment from the html string.

LayoutTests:

2008-06-21  Sam Weinig  <sam@webkit.org>

        Reviewed by Dan Bernstein.

        Test for https://bugs.webkit.org/show_bug.cgi?id=19647
        REGRESSION: Problem with extjs (insertAdjacentHTML)

        * fast/dynamic/insertAdjacentHTML-allowed-parents-expected.txt: Added.
        * fast/dynamic/insertAdjacentHTML-allowed-parents.html: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34721 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 234c23af
2008-06-21 Sam Weinig <sam@webkit.org>
Reviewed by Dan Bernstein.
Test for https://bugs.webkit.org/show_bug.cgi?id=19647
REGRESSION: Problem with extjs (insertAdjacentHTML)
* fast/dynamic/insertAdjacentHTML-allowed-parents-expected.txt: Added.
* fast/dynamic/insertAdjacentHTML-allowed-parents.html: Added.
2008-06-21 Adam Barth <abarth@webkit.org>
Reviewed by Sam Weinig.
PASS: insertAdjacentHTML did not throw an exception when using the a tag.
PASS: insertAdjacentHTML did not throw an exception when using the abbr tag.
PASS: insertAdjacentHTML did not throw an exception when using the acronym tag.
PASS: insertAdjacentHTML did not throw an exception when using the address tag.
PASS: insertAdjacentHTML did not throw an exception when using the applet tag.
PASS: insertAdjacentHTML did not throw an exception when using the area tag.
PASS: insertAdjacentHTML did not throw an exception when using the audio tag.
PASS: insertAdjacentHTML did not throw an exception when using the b tag.
PASS: insertAdjacentHTML did not throw an exception when using the base tag.
PASS: insertAdjacentHTML did not throw an exception when using the basefont tag.
PASS: insertAdjacentHTML did not throw an exception when using the bdo tag.
PASS: insertAdjacentHTML did not throw an exception when using the big tag.
PASS: insertAdjacentHTML did not throw an exception when using the blockquote tag.
PASS: insertAdjacentHTML did not throw an exception when using the body tag.
PASS: insertAdjacentHTML did not throw an exception when using the br tag.
PASS: insertAdjacentHTML did not throw an exception when using the button tag.
PASS: insertAdjacentHTML did not throw an exception when using the canvas tag.
PASS: insertAdjacentHTML did not throw an exception when using the caption tag.
PASS: insertAdjacentHTML did not throw an exception when using the center tag.
PASS: insertAdjacentHTML did not throw an exception when using the cite tag.
PASS: insertAdjacentHTML did not throw an exception when using the code tag.
PASS: insertAdjacentHTML did not throw an exception when using the col tag.
PASS: insertAdjacentHTML did not throw an exception when using the colgroup tag.
PASS: insertAdjacentHTML did not throw an exception when using the dd tag.
PASS: insertAdjacentHTML did not throw an exception when using the del tag.
PASS: insertAdjacentHTML did not throw an exception when using the dfn tag.
PASS: insertAdjacentHTML did not throw an exception when using the dir tag.
PASS: insertAdjacentHTML did not throw an exception when using the div tag.
PASS: insertAdjacentHTML did not throw an exception when using the dl tag.
PASS: insertAdjacentHTML did not throw an exception when using the dt tag.
PASS: insertAdjacentHTML did not throw an exception when using the em tag.
PASS: insertAdjacentHTML did not throw an exception when using the embed tag.
PASS: insertAdjacentHTML did not throw an exception when using the fieldset tag.
PASS: insertAdjacentHTML did not throw an exception when using the font tag.
PASS: insertAdjacentHTML did not throw an exception when using the form tag.
PASS: insertAdjacentHTML did not throw an exception when using the frame tag.
PASS: insertAdjacentHTML did not throw an exception when using the frameset tag.
PASS: insertAdjacentHTML did not throw an exception when using the h1 tag.
PASS: insertAdjacentHTML did not throw an exception when using the h2 tag.
PASS: insertAdjacentHTML did not throw an exception when using the h3 tag.
PASS: insertAdjacentHTML did not throw an exception when using the h4 tag.
PASS: insertAdjacentHTML did not throw an exception when using the h5 tag.
PASS: insertAdjacentHTML did not throw an exception when using the h6 tag.
PASS: insertAdjacentHTML did not throw an exception when using the head tag.
PASS: insertAdjacentHTML did not throw an exception when using the hr tag.
PASS: insertAdjacentHTML did not throw an exception when using the html tag.
PASS: insertAdjacentHTML did not throw an exception when using the i tag.
PASS: insertAdjacentHTML did not throw an exception when using the iframe tag.
PASS: insertAdjacentHTML did not throw an exception when using the image tag.
PASS: insertAdjacentHTML did not throw an exception when using the img tag.
PASS: insertAdjacentHTML did not throw an exception when using the input tag.
PASS: insertAdjacentHTML did not throw an exception when using the ins tag.
PASS: insertAdjacentHTML did not throw an exception when using the isindex tag.
PASS: insertAdjacentHTML did not throw an exception when using the kbd tag.
PASS: insertAdjacentHTML did not throw an exception when using the keygen tag.
PASS: insertAdjacentHTML did not throw an exception when using the label tag.
PASS: insertAdjacentHTML did not throw an exception when using the layer tag.
PASS: insertAdjacentHTML did not throw an exception when using the legend tag.
PASS: insertAdjacentHTML did not throw an exception when using the li tag.
PASS: insertAdjacentHTML did not throw an exception when using the link tag.
PASS: insertAdjacentHTML did not throw an exception when using the listing tag.
PASS: insertAdjacentHTML did not throw an exception when using the map tag.
PASS: insertAdjacentHTML did not throw an exception when using the marquee tag.
PASS: insertAdjacentHTML did not throw an exception when using the menu tag.
PASS: insertAdjacentHTML did not throw an exception when using the meta tag.
PASS: insertAdjacentHTML did not throw an exception when using the nobr tag.
PASS: insertAdjacentHTML did not throw an exception when using the noembed tag.
PASS: insertAdjacentHTML did not throw an exception when using the noframes tag.
PASS: insertAdjacentHTML did not throw an exception when using the nolayer tag.
PASS: insertAdjacentHTML did not throw an exception when using the noscript tag.
PASS: insertAdjacentHTML did not throw an exception when using the object tag.
PASS: insertAdjacentHTML did not throw an exception when using the ol tag.
PASS: insertAdjacentHTML did not throw an exception when using the optgroup tag.
PASS: insertAdjacentHTML did not throw an exception when using the option tag.
PASS: insertAdjacentHTML did not throw an exception when using the p tag.
PASS: insertAdjacentHTML did not throw an exception when using the param tag.
PASS: insertAdjacentHTML did not throw an exception when using the plaintext tag.
PASS: insertAdjacentHTML did not throw an exception when using the pre tag.
PASS: insertAdjacentHTML did not throw an exception when using the q tag.
PASS: insertAdjacentHTML did not throw an exception when using the s tag.
PASS: insertAdjacentHTML did not throw an exception when using the samp tag.
PASS: insertAdjacentHTML did not throw an exception when using the script tag.
PASS: insertAdjacentHTML did not throw an exception when using the select tag.
PASS: insertAdjacentHTML did not throw an exception when using the small tag.
PASS: insertAdjacentHTML did not throw an exception when using the source tag.
PASS: insertAdjacentHTML did not throw an exception when using the span tag.
PASS: insertAdjacentHTML did not throw an exception when using the strike tag.
PASS: insertAdjacentHTML did not throw an exception when using the strong tag.
PASS: insertAdjacentHTML did not throw an exception when using the style tag.
PASS: insertAdjacentHTML did not throw an exception when using the sub tag.
PASS: insertAdjacentHTML did not throw an exception when using the sup tag.
PASS: insertAdjacentHTML did not throw an exception when using the table tag.
PASS: insertAdjacentHTML did not throw an exception when using the tbody tag.
PASS: insertAdjacentHTML did not throw an exception when using the td tag.
PASS: insertAdjacentHTML did not throw an exception when using the textarea tag.
PASS: insertAdjacentHTML did not throw an exception when using the tfoot tag.
PASS: insertAdjacentHTML did not throw an exception when using the th tag.
PASS: insertAdjacentHTML did not throw an exception when using the thead tag.
PASS: insertAdjacentHTML did not throw an exception when using the title tag.
PASS: insertAdjacentHTML did not throw an exception when using the tr tag.
PASS: insertAdjacentHTML did not throw an exception when using the tt tag.
PASS: insertAdjacentHTML did not throw an exception when using the u tag.
PASS: insertAdjacentHTML did not throw an exception when using the ul tag.
PASS: insertAdjacentHTML did not throw an exception when using the var tag.
PASS: insertAdjacentHTML did not throw an exception when using the video tag.
PASS: insertAdjacentHTML did not throw an exception when using the wbr tag.
PASS: insertAdjacentHTML did not throw an exception when using the xmp tag.
PASS: insertAdjacentHTML did not throw an exception when using the unknown tag.
<head>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
log = function(msg)
{
document.getElementById('console').appendChild(document.createTextNode(msg + "\n"));
}
var testZone;
test = function(tag)
{
var el = document.createElement(tag);
testZone.appendChild(el);
try {
el.insertAdjacentHTML("beforeBegin", "HTML");
log("PASS: insertAdjacentHTML did not throw an exception when using the " + tag + " tag.");
} catch(e) {
log("FAIL: insertAdjacentHTML threw an exception when using the " + tag + " tag: " + e);
}
testZone.innerHTML = "";
}
onload = function()
{
testZone = document.getElementById('testZone');
var tags = ["a",
"abbr",
"acronym",
"address",
"applet",
"area",
"audio",
"b",
"base",
"basefont",
"bdo",
"big",
"blockquote",
"body",
"br",
"button",
"canvas",
"caption",
"center",
"cite",
"code",
"col",
"colgroup",
"dd",
"del",
"dfn",
"dir",
"div",
"dl",
"dt",
"em",
"embed",
"fieldset",
"font",
"form",
"frame",
"frameset",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"head",
"hr",
"html",
"i",
"iframe",
"image",
"img",
"input",
"ins",
"isindex",
"kbd",
"keygen",
"label",
"layer",
"legend",
"li",
"link",
"listing",
"map",
"marquee",
"menu",
"meta",
"nobr",
"noembed",
"noframes",
"nolayer",
"noscript",
"object",
"ol",
"optgroup",
"option",
"p",
"param",
"plaintext",
"pre",
"q",
"s",
"samp",
"script",
"select",
"small",
"source",
"span",
"strike",
"strong",
"style",
"sub",
"sup",
"table",
"tbody",
"td",
"textarea",
"tfoot",
"th",
"thead",
"title",
"tr",
"tt",
"u",
"ul",
"var",
"video",
"wbr",
"xmp"];
for (var i = 0; i < tags.length; ++i) {
test(tags[i]);
}
test("unknown");
}
</script>
</head>
<body>
<pre id="console"></pre>
<div id="testZone"></div>
</body>
2008-06-21 Sam Weinig <sam@webkit.org>
Reviewed by Dan Bernstein.
Fix for https://bugs.webkit.org/show_bug.cgi?id=19647
REGRESSION: Problem with extjs (insertAdjacentHTML)
Test: fast/dynamic/insertAdjacentHTML-allowed-parents.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::insertAdjacentHTML): Don't use innerHTML logic for creating
the DocumentFragment from the html string.
2008-06-21 Adam Barth <abarth@webkit.org>
Reviewed by Sam Weinig.
......@@ -539,12 +539,13 @@ Element* HTMLElement::insertAdjacentElement(const String& where, Element* newChi
void HTMLElement::insertAdjacentHTML(const String& where, const String& html, ExceptionCode& ec)
{
// FIXME: perhaps this should use createFragmentFromMarkup() instead as
// createContextualFragment() has all sorts of odd rules in it.
RefPtr<DocumentFragment> fragment = createContextualFragment(html);
if (!fragment) {
ec = NO_MODIFICATION_ALLOWED_ERR;
return;
RefPtr<DocumentFragment> fragment = document()->createDocumentFragment();
if (document()->isHTMLDocument())
parseHTMLDocumentFragment(html, fragment.get());
else {
if (!parseXMLDocumentFragment(html, fragment.get(), this))
// FIXME: We should propagate a syntax error exception out here.
return;
}
insertAdjacent(where, fragment.get(), ec);
......
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