<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>ownerDocument of Attr should be set on setAttributeNode</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
</head>
<body>
<iframe></iframe>
<div id="toBeMoved"></div>
<script>
setup({single_test: true});
elementToBeMoved = document.getElementById("toBeMoved");
iframeElement = document.getElementsByTagName("iframe")[0];
iframeDocument = iframeElement.contentWindow.document;
attr = iframeDocument.createAttribute("foo");
assert_equals(attr.ownerDocument, iframeDocument);
elementToBeMoved.setAttributeNode(attr);
assert_equals(attr.ownerDocument, document);
iframeDocument.documentElement.appendChild(elementToBeMoved);
assert_equals(attr.ownerDocument, iframeDocument);
done();
</script>
</body>
</html>