summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/dom/elements/global-attributes/the-anchor-attribute-xml.tentative.html
blob: c5e6d81826dea22d7eb96d659ac7d55782e4390f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<link rel=author href="mailto:jarhar@chromium.org">
<link rel="help" href="https://github.com/whatwg/html/pull/9144">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<body>
<script>
test(() => {
  const xmlDoc = document.implementation.createDocument(null, 'root', null);
  assert_equals(xmlDoc.contentType, 'application/xml');
  xmlDoc.documentElement.innerHTML = '<div id="target">target</div><div anchor="target">anchored</div>';
  assert_equals(xmlDoc.documentElement.innerHTML,
    '<div id="target">target</div><div anchor="target">anchored</div>');
  const target = xmlDoc.documentElement.children[0];
  const anchored = xmlDoc.documentElement.children[1];

  assert_equals(xmlDoc.documentElement.children[1].anchorElement, null,
    'Setting the anchor attribute in XML should not set the anchorElement IDL.');

  anchored.anchorElement = target;
  assert_equals(xmlDoc.documentElement.children[1].anchorElement, null,
    'Setting element.anchorElement in an XML document should not set the anchorElement IDL.');
});
</script>