| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
| 3 <title>Tests for known named character references</title> | 3 <title>Tests for known named character references</title> |
| 4 <meta name=viewport content="width=device-width"> | 4 <meta name=viewport content="width=device-width"> |
| 5 <!-- Alternative output: http://mathias.html5.org/tests/html/named-character-re
ferences/ --> | 5 <!-- Alternative output: http://mathias.html5.org/tests/html/named-character-re
ferences/ --> |
| 6 <div id=log></div> | 6 <div id=log></div> |
| 7 <script src=../../../../../resources/testharness.js></script> | 7 <script src=/resources/testharness.js></script> |
| 8 <script src=../../../../../resources/testharnessreport.js></script> | 8 <script src=/resources/testharnessreport.js></script> |
| 9 <script src=named-character-references-data.js></script> | 9 <script src=named-character-references-data.js></script> |
| 10 <script> | 10 <script> |
| 11 (function() { | 11 (function() { |
| 12 | 12 |
| 13 function pad(string, totalCharacters) { | 13 function pad(string, totalCharacters) { |
| 14 return totalCharacters < string.length ? string : (Array(totalCharacters +
1).join('0') + string).slice(-totalCharacters); | 14 return totalCharacters < string.length ? string : (Array(totalCharacters +
1).join('0') + string).slice(-totalCharacters); |
| 15 } | 15 } |
| 16 | 16 |
| 17 var dummy = document.createElement('p'); | 17 var dummy = document.createElement('p'); |
| 18 | 18 |
| 19 Object.keys(data).forEach(function(entity) { | 19 Object.keys(data).forEach(function(entity) { |
| 20 var object = data[entity]; | 20 var object = data[entity]; |
| 21 dummy.innerHTML = entity; | 21 dummy.innerHTML = entity; |
| 22 test( | 22 test( |
| 23 function() { | 23 function() { |
| 24 assert_equals( | 24 assert_equals( |
| 25 dummy.textContent, | 25 dummy.textContent, |
| 26 object.characters | 26 object.characters |
| 27 ); | 27 ); |
| 28 }, | 28 }, |
| 29 entity + ' should match ' + object.codepoints.map(function(codePoint) { | 29 entity + ' should match ' + object.codepoints.map(function(codePoint) { |
| 30 return 'U+' + pad(codePoint.toString(16).toUpperCase(), 5); | 30 return 'U+' + pad(codePoint.toString(16).toUpperCase(), 5); |
| 31 }).join(' ') | 31 }).join(' ') |
| 32 ); | 32 ); |
| 33 }); | 33 }); |
| 34 | 34 |
| 35 }()); | 35 }()); |
| 36 </script> | 36 </script> |
| OLD | NEW |