Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / custom / xlink-prefix-in-attributes.html
blob71a19e8d6f1c268afff33f416c85a41fda5b4057
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <script type="text/javascript">
4 function runTest()
6 if (window.testRunner)
7 testRunner.dumpAsText();
9 var target = document.getElementById("target");
11 var svgns = "http://www.w3.org/2000/svg";
12 var xmlnsns = "http://www.w3.org/2000/xmlns/";
13 var xlinkns = "http://www.w3.org/1999/xlink";
15 // SVG with correct xmlns prefix on xlink
16 var svg = document.createElementNS(svgns, "svg");
17 svg.setAttributeNS(xmlnsns, 'xmlns', svgns);
18 svg.setAttributeNS(null, "svg", svgns);
19 svg.setAttributeNS(xmlnsns, "xmlns:xlink", xlinkns);
20 svg.setAttributeNS(null, "width", "200");
21 svg.setAttributeNS(null, "height", "200");
23 // Already correct xlink:href
24 var image = document.createElementNS(svgns, "image");
25 image.setAttributeNS(null, "width", "20");
26 image.setAttributeNS(null, "height", "20");
27 image.setAttributeNS(xlinkns, "xlink:href", "resources/green-checker.png");
28 svg.appendChild(image);
30 // Missing prefix from href. Must be added when serialized.
31 var image = document.createElementNS(svgns, "image");
32 image.setAttributeNS(null, "x", "0");
33 image.setAttributeNS(null, "y", "30");
34 image.setAttributeNS(null, "width", "20");
35 image.setAttributeNS(null, "height", "20");
36 image.setAttributeNS(xlinkns, "href", "resources/green-checker.png");
37 svg.appendChild(image);
39 target.appendChild(svg);
41 var serializer = new XMLSerializer();
42 var xmlString = serializer.serializeToString(target);
44 var xlink_str = '<El a:title="C" a:href="H" xmlns:a="http://www.w3.org/1999/xlink" />';
45 var xlink_dom = new DOMParser().parseFromString(xlink_str, 'text/xml');
46 var xlink_output = serializer.serializeToString(xlink_dom);
48 var svgText = document.getElementById("svgoutput");
49 svgText.textContent = xmlString + "\n" + xlink_output;
51 </script>
52 </head>
53 <body onload="runTest()">
54 <div id="target"/>
55 <div id="svgoutput"/>
56 </body>
57 </html>