OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <title>SVGURIReference.href IDL semantics</title> | 2 <title>SVGURIReference.href IDL semantics</title> |
3 <script src="../../resources/testharness.js"></script> | 3 <script src="../../resources/testharness.js"></script> |
4 <script src="../../resources/testharnessreport.js"></script> | 4 <script src="../../resources/testharnessreport.js"></script> |
5 <script> | 5 <script> |
6 const svgNs = 'http://www.w3.org/2000/svg'; | 6 const svgNs = 'http://www.w3.org/2000/svg'; |
7 const xlinkNs = 'http://www.w3.org/1999/xlink'; | 7 const xlinkNs = 'http://www.w3.org/1999/xlink'; |
8 | 8 |
9 test(function() { | 9 test(function() { |
10 var element = document.createElementNS(svgNs, 'a'); | 10 var element = document.createElementNS(svgNs, 'a'); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 var element = document.createElementNS(svgNs, 'a'); | 127 var element = document.createElementNS(svgNs, 'a'); |
128 element.setAttributeNS(xlinkNs, 'xlink:href', 'bar'); | 128 element.setAttributeNS(xlinkNs, 'xlink:href', 'bar'); |
129 assert_false(element.hasAttributeNS(null, 'href'), '"href" does not exist'); | 129 assert_false(element.hasAttributeNS(null, 'href'), '"href" does not exist'); |
130 assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists'); | 130 assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists'); |
131 assert_equals(element.href.baseVal, 'bar', 'baseVal reflects "xlink:href"'); | 131 assert_equals(element.href.baseVal, 'bar', 'baseVal reflects "xlink:href"'); |
132 | 132 |
133 element.removeAttributeNS(xlinkNs, 'href'); | 133 element.removeAttributeNS(xlinkNs, 'href'); |
134 assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" no longe
r exist'); | 134 assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" no longe
r exist'); |
135 assert_equals(element.href.baseVal, ''); | 135 assert_equals(element.href.baseVal, ''); |
136 }, document.title+', IDL href reflects "xlink:href"; removeAttribute(xlink:href)
w/o NS-prefix resets to default.'); | 136 }, document.title+', IDL href reflects "xlink:href"; removeAttribute(xlink:href)
w/o NS-prefix resets to default.'); |
| 137 |
| 138 test(function() { |
| 139 var element = document.createElementNS(svgNs, 'a'); |
| 140 element.setAttributeNS(xlinkNs, 'xlink:href', 'bar'); |
| 141 assert_false(element.hasAttributeNS(null, 'href'), '"href" does not exist'); |
| 142 assert_true(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" exists'); |
| 143 assert_equals(element.href.baseVal, 'bar', 'baseVal reflects "xlink:href"'); |
| 144 assert_equals(element.href.animVal, 'bar', 'animVal reflects "xlink:href"'); |
| 145 }, document.title+', href.animVal reflects "xlink:href" when it is set.'); |
| 146 |
| 147 test(function() { |
| 148 var element = document.createElementNS(svgNs, 'a'); |
| 149 element.setAttributeNS(null, 'href', 'bar'); |
| 150 assert_true(element.hasAttributeNS(null, 'href'), '"href" exists'); |
| 151 assert_false(element.hasAttributeNS(xlinkNs, 'href'), '"xlink:href" does not
exist'); |
| 152 assert_equals(element.href.baseVal, 'bar', 'baseVal reflects "href"'); |
| 153 assert_equals(element.href.animVal, 'bar', 'animVal reflects "href"'); |
| 154 }, document.title+', href.animVal reflects "href" when it is set.'); |
137 </script> | 155 </script> |
OLD | NEW |