6 <p>Test for
<a href=
"https://bugs.webkit.org/show_bug.cgi?id=18421">bug
18421</a>:
7 XMLHttpRequest does not properly encode
& and
< in outgoing messages.
</p>
9 <script type=
"text/javascript">
10 if (window
.testRunner
)
11 testRunner
.dumpAsText();
13 // Create a new document
14 var dom
= document
.implementation
.createDocument("","", null);
16 // Create the root node
17 var root
= dom
.appendChild(dom
.createElement("foo"));
20 root
.setAttribute("foo", "a&b");
23 var txt
= dom
.createTextNode("a&b");
26 root
.appendChild(txt
);
28 // Create the XHR object
29 var xhr
= new XMLHttpRequest();
30 xhr
.open("POST", "resources/post-echo.cgi", false);
33 if (xhr
.responseText
== '<foo foo="a&b">a&b</foo>')
34 document
.body
.innerHTML
+="PASS";
36 document
.body
.innerHTML
+="FAIL: <xmp>" + xhr
.responseText
+ "</xmp>";