test10.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  5. <title>Test 010</title>
  6. <script>
  7. var Hyphenopoly = {
  8. require: {
  9. "de": "FORCEHYPHENOPOLY"
  10. },
  11. setup: {
  12. hide: "element",
  13. selectors: {
  14. ".class1": {
  15. hyphen: "·"
  16. },
  17. ".class2": {
  18. hyphen: String.fromCharCode(173)
  19. }
  20. }
  21. },
  22. handleEvent: {
  23. hyphenopolyEnd: function (e) {
  24. assert();
  25. }
  26. }
  27. };
  28. function assert() {
  29. var tests = 1;
  30. var i = 1;
  31. var test = "";
  32. var ref = "";
  33. var result = true;
  34. while (i <= tests) {
  35. test = document.getElementById("test" + i).textContent;
  36. ref = document.getElementById("ref" + i).textContent;
  37. if (test === ref) {
  38. document.getElementById("result").innerHTML += "<p style=\"background-color: #d6ffd6\">" + i + " passed</p>";
  39. result = result && true;
  40. } else {
  41. document.getElementById("result").innerHTML += "<p style=\"background-color: #ffd6d6\">" + i + " failed</p>";
  42. result = false;
  43. }
  44. i += 1;
  45. }
  46. if (parent != window) {
  47. parent.postMessage(JSON.stringify({
  48. desc: document.getElementById("desc").innerHTML,
  49. index: 10,
  50. result: (result ? "passed" : "failed")
  51. }), window.location.href);
  52. }
  53. }
  54. document.addEventListener("DOMContentLoaded", function() {
  55. document.getElementById("pastebin").addEventListener("keyup", function(e) {
  56. this.value += "\n" + Array.prototype.map.call(this.value, function (x) {
  57. return x.charCodeAt(0)
  58. });
  59. }, true);
  60. });
  61. </script>
  62. <script src="../Hyphenopoly_Loader.js"></script>
  63. <style type="text/css">
  64. body {
  65. width:50%;
  66. margin-left:25%;
  67. margin-right:25%;
  68. }
  69. .italic {
  70. font-style: italic;
  71. }
  72. .test {
  73. background-color: #D8E2F9;
  74. }
  75. .ref {
  76. background-color: #FEEFC0;
  77. }
  78. .hyphenate {
  79. hyphens: auto;
  80. -ms-hyphens: auto;
  81. -moz-hyphens: auto;
  82. -webkit-hyphens: auto;
  83. }
  84. </style>
  85. </head>
  86. <body>
  87. <div id="navigate"><a href="index.html">&Larr;&nbsp;Index</a>&nbsp;&nbsp;<a href="test9.html">&larr;&nbsp;Prev</a>&nbsp;&nbsp;<a href="test11.html">Next&nbsp;&rarr;</a></div>
  88. <h1>Test 010</h1>
  89. <p id="desc">Check copy hack</p>
  90. <div id="result"></div>
  91. <hr>
  92. <h2>1: class1</h2>
  93. <p id="test1" class="test class1" lang="de">Silbentrennung: <span class="class2 italic">Die Worttrennung, auch Silbentrennung genannt, bezeichnet in der Orthographie die Art und Weise, wie die Wörter insbesondere am Zeilenende getrennt werden können.</span></p>
  94. <p id="ref1" class="ref" lang="de">Sil·ben·tren·nung: <span class="italic">Die Wort&shy;tren&shy;nung, auch Sil&shy;ben&shy;tren&shy;nung ge&shy;nannt, be&shy;zeich&shy;net in der Or&shy;tho&shy;gra&shy;phie die Art und Weise, wie die Wör&shy;ter ins&shy;be&shy;son&shy;de&shy;re am Zei&shy;len&shy;en&shy;de ge&shy;trennt wer&shy;den kön&shy;nen.</span></p>
  95. <hr>
  96. <textarea id="pastebin" placeholder="paste here" cols="40"></textarea>
  97. <div><span class="test">Test</span> <span class="ref">Ref</span></div>
  98. </body>
  99. </html>