test12.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Test 012</title>
  6. <script>
  7. var Hyphenopoly = {
  8. require: {
  9. "de": "FORCEHYPHENOPOLY"
  10. },
  11. setup: {
  12. dontHyphenate: {
  13. kbd: false,
  14. button: false,
  15. span: true
  16. },
  17. selectors: {
  18. ".hyphenate": {
  19. hyphen: "•"
  20. },
  21. ".h9n_btn": {}
  22. }
  23. },
  24. handleEvent: {
  25. hyphenopolyEnd: function (e) {
  26. assert();
  27. }
  28. }
  29. };
  30. function assert() {
  31. var tests = 1;
  32. var i = 1;
  33. var test = "";
  34. var ref = "";
  35. var result = false;
  36. while (i <= tests) {
  37. test = document.getElementById("test" + i).innerHTML;
  38. ref = document.getElementById("ref" + i).innerHTML;
  39. if (test === ref) {
  40. document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed</p>";
  41. result = result || true;
  42. } else {
  43. document.getElementById("result").innerHTML += "<p style=\"background-color: #ffd6d6\">" + i + " failed</p>";
  44. result = result || false;
  45. }
  46. i += 1;
  47. }
  48. if (parent != window) {
  49. parent.postMessage(JSON.stringify({
  50. desc: document.getElementById("desc").innerHTML,
  51. index: 12,
  52. result: (result ? "passed" : "failed")
  53. }), window.location.href);
  54. }
  55. }
  56. </script>
  57. <script src="../Hyphenopoly_Loader.js"></script>
  58. <style type="text/css">
  59. body {
  60. width:50%;
  61. margin-left:25%;
  62. margin-right:25%;
  63. }
  64. .test {
  65. background-color: #D8E2F9;
  66. }
  67. .ref {
  68. background-color: #FEEFC0;
  69. }
  70. .h9n_btn {
  71. width: 5em;
  72. text-align: left;
  73. }
  74. .hyphenate {
  75. hyphens: auto;
  76. -ms-hyphens: auto;
  77. -moz-hyphens: auto;
  78. -webkit-hyphens: auto;
  79. }
  80. </style>
  81. </head>
  82. <body>
  83. <div id="navigate"><a href="index.html">&Larr;&nbsp;Index</a>&nbsp;|&nbsp;<a href="test11.html">&larr;&nbsp;Prev</a>&nbsp;|&nbsp;<a href="test13.html">Next&nbsp;&rarr;</a></div>
  84. <h1>Test 012</h1>
  85. <p id="desc">Check dontHyphenate-Elements</p>
  86. <div id="result"></div>
  87. <hr>
  88. <p id="test1" class="test hyphenate" lang="de">Silbentrennung <code>Silbentrennung</code> <kbd>Silbentrennung</kbd> <button class="h9n_btn">Silbentrennung</button> <span>Silbentrennung</span></p>
  89. <p id="ref1" class="ref" lang="de">Sil•ben•tren•nung <code>Silbentrennung</code> <kbd>Sil•ben•tren•nung</kbd> <button class="h9n_btn">Sil&shy;ben&shy;tren&shy;nung</button> <span>Silbentrennung</span></p>
  90. <hr>
  91. <div><span class="test">Test</span> <span class="ref">Ref</span></div>
  92. </body>
  93. </html>