test35.html 3.0 KB

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