the-anchor-attribute-xml.tentative.html (947B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel="help" href="https://github.com/whatwg/html/pull/9144"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 7 <body> 8 <script> 9 test(() => { 10 const xmlDoc = document.implementation.createDocument(null, 'root', null); 11 assert_equals(xmlDoc.contentType, 'application/xml'); 12 const innerDoc = xmlDoc.documentElement; 13 const html = '<div id="target">target</div><div anchor="target">anchored</div>'; 14 innerDoc.innerHTML = html; 15 assert_equals(innerDoc.innerHTML, html); 16 const target = innerDoc.children[0]; 17 const anchored = innerDoc.children[1]; 18 19 assert_equals(anchored.anchorElement, target, 'Setting the anchor attribute in XML should work.'); 20 21 anchored.anchorElement = target; 22 assert_equals(anchored.anchorElement, target, 'Setting element.anchorElement in an XML document should work.'); 23 }); 24 </script>