|
1 | 1 | <!DOCTYPE html> |
2 | 2 | <script src="../testing.js"></script> |
3 | 3 |
|
4 | | -<svg width="200" height="100" style="border:1px solid #ccc" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 100"> |
| 4 | +<svg id=lower width="200" height="100" style="border:1px solid #ccc" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 100"> |
5 | 5 | <rect></rect> |
6 | 6 | <text x="100" y="95" font-size="14" text-anchor="middle">OVER 9000!!</text> |
7 | 7 | </svg> |
8 | 8 |
|
| 9 | +<SVG ID=UPPER WIDTH="200" HEIGHT="100" STYLE="BORDER:1PX SOLID #CCC" XMLNS="http://www.w3.org/2000/svg" VIEWBOX="0 0 200 100"> |
| 10 | + <RECT></RECT> |
| 11 | + <TEXT X="100" Y="95" FONT-SIZE="14" TEXT-ANCHOR="MIDDLE">OVER 9000!!!</TEXT> |
| 12 | +</SVG> |
| 13 | + |
9 | 14 | <script id=svg> |
10 | 15 | testing.expectEqual(false, 'AString' instanceof SVGElement); |
11 | 16 |
|
12 | | - const svg = document.querySelector('svg'); |
13 | | - testing.expectEqual('http://www.w3.org/2000/svg', svg.getAttribute('xmlns')); |
14 | | - testing.expectEqual('http://www.w3.org/2000/svg', svg.getAttributeNode('xmlns').value); |
15 | | - testing.expectEqual('http://www.w3.org/2000/svg', svg.attributes.getNamedItem('xmlns').value); |
16 | | - testing.expectEqual('0 0 200 100', svg.getAttribute('viewBox')); |
17 | | - testing.expectEqual('viewBox', svg.getAttributeNode('viewBox').name); |
18 | | - testing.expectEqual(true, svg.outerHTML.includes('viewBox')); |
| 17 | + const svg1 = $('#lower'); |
| 18 | + testing.expectEqual('http://www.w3.org/2000/svg', svg1.getAttribute('xmlns')); |
| 19 | + testing.expectEqual('http://www.w3.org/2000/svg', svg1.getAttributeNode('xmlns').value); |
| 20 | + testing.expectEqual('http://www.w3.org/2000/svg', svg1.attributes.getNamedItem('xmlns').value); |
| 21 | + testing.expectEqual('0 0 200 100', svg1.getAttribute('viewBox')); |
| 22 | + testing.expectEqual('viewBox', svg1.getAttributeNode('viewBox').name); |
| 23 | + testing.expectEqual(true, svg1.outerHTML.includes('viewBox')); |
| 24 | + testing.expectEqual('svg', svg1.tagName); |
| 25 | + testing.expectEqual('rect', svg1.querySelector('rect').tagName); |
| 26 | + testing.expectEqual('text', svg1.querySelector('text').tagName); |
| 27 | + |
| 28 | + const svg2 = $('#UPPER'); |
| 29 | + testing.expectEqual('http://www.w3.org/2000/svg', svg2.getAttribute('xmlns')); |
| 30 | + testing.expectEqual('http://www.w3.org/2000/svg', svg2.getAttributeNode('xmlns').value); |
| 31 | + testing.expectEqual('http://www.w3.org/2000/svg', svg2.attributes.getNamedItem('xmlns').value); |
| 32 | + testing.expectEqual('0 0 200 100', svg2.getAttribute('viewBox')); |
| 33 | + testing.expectEqual('viewBox', svg2.getAttributeNode('viewBox').name); |
| 34 | + testing.expectEqual(true, svg2.outerHTML.includes('viewBox')); |
| 35 | + testing.expectEqual('svg', svg2.tagName); |
| 36 | + testing.expectEqual('rect', svg2.querySelector('rect').tagName); |
| 37 | + testing.expectEqual('text', svg2.querySelector('text').tagName); |
19 | 38 | </script> |
0 commit comments