123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <title>Test 018</title>
- <script>
- var Hyphenopoly = {
- require: {
- "de": "FORCEHYPHENOPOLY"
- },
- setup: {
- selectors: {
- ".hyphenate": {
- hyphen: "•"
- }
- }
- },
- handleEvent: {
- hyphenopolyEnd: function (e) {
- assert();
- }
- }
- };
- var assertRunCount = 0;
- function assert() {
- assertRunCount += 1;
- var tests = (assertRunCount === 1) ? 1 : 3;
- var i = 1;
- var test = "";
- var ref = "";
- var result = false;
- document.getElementById("result").innerHTML = "";
- while (i <= tests) {
- test = document.getElementById("test" + i).innerHTML;
- ref = document.getElementById("ref" + i).innerHTML;
- if (test === ref) {
- document.getElementById("result").innerHTML += "<span style=\"background-color: #d6ffd6\">" + i + "</span> ";
- result = result || true;
- } else {
- document.getElementById("result").innerHTML += "<span style=\"background-color: #ffd6d6\">" + i + "</span> ";
- result = result || false;
- }
- i += 1;
- }
- if (parent != window && assertRunCount === 2) {
- parent.postMessage(JSON.stringify({
- desc: document.getElementById("desc").innerHTML,
- index: 18,
- result: (result ? "passed" : "failed")
- }), window.location.href);
- }
- }
- window.setTimeout(function () {
- document.getElementById("test1").innerHTML = "Typografie";
- document.getElementById("ref1").innerHTML = "Ty•po•gra•fie";
- document.getElementById("test2").innerHTML = "Textlayout";
- document.getElementById("ref2").innerHTML = "Text•lay•out";
- document.getElementById("test3").innerHTML ='<p class="hyphenate">Satzstruktur</p>';
- document.getElementById("ref3").innerHTML ='<p class="hyphenate">Satz•struk•tur</p>';
- Hyphenopoly.events.dispatch("contentLoaded");
- }, 500);
- </script>
- <script src="../Hyphenopoly_Loader.js"></script>
- <style type="text/css">
- body {
- width:50%;
- margin-left:25%;
- margin-right:25%;
- }
- .test {
- background-color: #D8E2F9;
- }
- .ref {
- background-color: #FEEFC0;
- }
- </style>
- </head>
- <body>
- <div id="navigate"><a href="index.html">↞ Index</a> | <a href="test17.html">← Prev</a> | <a href="test19.html">Next →</a></div>
- <h1>Test 018</h1>
- <p id="desc">Hyphenate element manually</p>
- <div id="result">wait for it...</div>
- <hr>
- <h2>1: Hyphenate on load, changed later</h2>
- <p id="test1" class="test hyphenate" lang="de">Silbentrennungsalgorithmus</p>
- <p id="ref1" class="ref" lang="de">Sil•ben•tren•nungs•al•go•rith•mus</p>
- <h2>2: Hyphenate text added to element with class="hyphenate"</h2>
- <p id="test2" class="test hyphenate" lang="de"></p>
- <p id="ref2" class="ref" lang="de"></p>
- <h2>3: Hyphenate element with class="hyphenate" added to container</h2>
- <div id="test3" class="test" lang="de"></div>
- <div id="ref3" class="ref" lang="de"></div>
- <hr>
- <div><span class="test">Test</span> <span class="ref">Ref</span></div>
- </body>
- </html>
|