tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Node-cloneNode-svg.html (1933B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <title>Cloning of SVG elements and attributes</title>
      4 <link rel="help" href="https://dom.spec.whatwg.org/#dom-node-clonenode">
      5 <link rel="help" href="https://dom.spec.whatwg.org/#concept-node-clone">
      6 <!-- regression test for https://github.com/jsdom/jsdom/issues/1601 -->
      7 
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 
     11 <svg xmlns:xlink='http://www.w3.org/1999/xlink'><use xlink:href='#test'></use></svg>
     12 
     13 <script>
     14 "use strict";
     15 
     16 const svg = document.querySelector("svg");
     17 const clone = svg.cloneNode(true);
     18 
     19 test(() => {
     20 
     21  assert_equals(clone.namespaceURI, "http://www.w3.org/2000/svg");
     22  assert_equals(clone.prefix, null);
     23  assert_equals(clone.localName, "svg");
     24  assert_equals(clone.tagName, "svg");
     25 
     26 }, "cloned <svg> should have the right properties");
     27 
     28 test(() => {
     29 
     30  const attr = clone.attributes[0];
     31 
     32  assert_equals(attr.namespaceURI, "http://www.w3.org/2000/xmlns/");
     33  assert_equals(attr.prefix, "xmlns");
     34  assert_equals(attr.localName, "xlink");
     35  assert_equals(attr.name, "xmlns:xlink");
     36  assert_equals(attr.value, "http://www.w3.org/1999/xlink");
     37 
     38 }, "cloned <svg>'s xmlns:xlink attribute should have the right properties");
     39 
     40 test(() => {
     41 
     42  const use = clone.firstElementChild;
     43  assert_equals(use.namespaceURI, "http://www.w3.org/2000/svg");
     44  assert_equals(use.prefix, null);
     45  assert_equals(use.localName, "use");
     46  assert_equals(use.tagName, "use");
     47 
     48 }, "cloned <use> should have the right properties");
     49 
     50 test(() => {
     51 
     52  const use = clone.firstElementChild;
     53  const attr = use.attributes[0];
     54 
     55  assert_equals(attr.namespaceURI, "http://www.w3.org/1999/xlink");
     56  assert_equals(attr.prefix, "xlink");
     57  assert_equals(attr.localName, "href");
     58  assert_equals(attr.name, "xlink:href");
     59  assert_equals(attr.value, "#test");
     60 
     61 }, "cloned <use>'s xlink:href attribute should have the right properties");
     62 
     63 </script>