test22.html 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Test 022</title>
  6. <script>
  7. var Hyphenopoly = {
  8. require: {
  9. "de": "FORCEHYPHENOPOLY"
  10. },
  11. setup: {
  12. selectors: {
  13. ".hyphenate": {
  14. hyphen: "•"
  15. }
  16. },
  17. normalize: true
  18. },
  19. handleEvent: {
  20. hyphenopolyEnd: function (e) {
  21. assert();
  22. }
  23. }
  24. };
  25. function assert() {
  26. var tests = 1;
  27. var i = 1;
  28. var test = "";
  29. var ref = "";
  30. var result = false;
  31. while (i <= tests) {
  32. test = document.getElementById("test" + i).innerHTML;
  33. ref = document.getElementById("ref" + i).innerHTML;
  34. if (test === ref) {
  35. document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed</p>";
  36. result = result || true;
  37. } else {
  38. document.getElementById("result").innerHTML += "<p style=\"background-color: #ffd6d6\">" + i + " failed</p>";
  39. result = result || false;
  40. }
  41. i += 1;
  42. }
  43. if (parent != window) {
  44. parent.postMessage(JSON.stringify({
  45. desc: document.getElementById("desc").innerHTML,
  46. index: 22,
  47. result: (result ? "passed" : "failed")
  48. }), window.location.href);
  49. }
  50. }
  51. </script>
  52. <script src="../Hyphenopoly_Loader.js"></script>
  53. <style type="text/css">
  54. body {
  55. width:50%;
  56. margin-left:25%;
  57. margin-right:25%;
  58. }
  59. .test {
  60. background-color: #D8E2F9;
  61. }
  62. .ref {
  63. background-color: #FEEFC0;
  64. }
  65. .hyphenate {
  66. hyphens: auto;
  67. -ms-hyphens: auto;
  68. -moz-hyphens: auto;
  69. -webkit-hyphens: auto;
  70. }
  71. </style>
  72. </head>
  73. <body>
  74. <div id="navigate"><a href="index.html">&Larr;&nbsp;Index</a>&nbsp;|&nbsp;<a href="test21.html">&larr;&nbsp;Prev</a>&nbsp;|&nbsp;<a href="test23.html">Next&nbsp;&rarr;</a></div>
  75. <h1>Test 022</h1>
  76. <p id="desc">Normalize combined characters (not supported in all clients)</p>
  77. <div id="result"></div>
  78. <hr>
  79. <p id="test1" class="test hyphenate" lang="de">Bärentöter Ba&#x0308;rento&#x0308;ter</p>
  80. <p id="ref1" class="ref" lang="de">Bä•ren•tö•ter Bä•ren•tö•ter</p>
  81. <hr>
  82. <div><span class="test">Test</span> <span class="ref">Ref</span></div>
  83. </body>
  84. </html>