| <p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=15650">bug 15650</a>: |
| XML attribute nodes are not importable.</p> |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| try { |
| var xmld = new DOMParser().parseFromString( "<foo test='baz'/>", "text/xml"); |
| var xmld2 = new DOMParser().parseFromString("<bar/>", "text/xml"); |
| |
| var srcElem = xmld.documentElement; |
| var dstElem = xmld2.documentElement; |
| |
| var importedNode = xmld2.importNode(srcElem.attributes["test"], false); |
| if (importedNode.nodeValue != "baz") |
| throw "wrong imported attribute child: '" + importedNode.nodeValue + "'"; |
| |
| dstElem.setAttributeNode(importedNode); |
| if (dstElem.getAttribute("test") != "baz") |
| throw "wrong imported attribute value: '" + dstElem.getAttribute("test") + "'"; |
| |
| document.write("<div>SUCCESS</div>"); |
| } catch (ex) { |
| document.write("<div>" + ex + "</div>"); |
| } |
| </script> |