Skip to content

Commit

Permalink
fixes for IE11🙄
Browse files Browse the repository at this point in the history
  • Loading branch information
mnater committed May 27, 2019
1 parent 9f3f497 commit 5c53a01
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Hyphenopoly.js
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@
if (H.cf.wasm) {
return Math.ceil(targetSize / 65536) * 65536;
}
const exp = Math.ceil(Math.log2(targetSize));
const exp = Math.ceil(Math.log(targetSize) * Math.LOG2E);
if (exp <= 12) {
return 1 << 12;
}
Expand Down
4 changes: 2 additions & 2 deletions Hyphenopoly_Loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"use strict";

const store = sessionStorage;
const wa = WebAssembly;
const wa = w.WebAssembly;
const lcFallbacks = new Map();
const lcRequire = new Map();

Expand Down Expand Up @@ -68,7 +68,7 @@
(function configPaths() {
const maindir = (d.currentScript)
? d.currentScript.src.replace(/Hyphenopoly_Loader.js/i, "")
: "../Hyphenopoly/";
: "../";
const patterndir = maindir + "patterns/";
if (H.paths) {
H.paths.maindir = H.paths.maindir || maindir;
Expand Down
77 changes: 46 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 18 additions & 7 deletions testsuite/test36.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,24 @@

window.onload = function () {
function hyphenate_fur(text) {
Hyphenopoly.hyphenators.fur.then(
function (furhyph) {
document.getElementById("test1").innerText = furhyph(text);
assertAll();
}).catch(function(e) {
assertError(e);
});
if (window.Promise) {
Hyphenopoly.hyphenators.fur.then(
function (furhyph) {
document.getElementById("test1").innerText = furhyph(text);
assertAll();
}).catch(function(e) {
assertError(e);
});
} else {
result = false
if (parent != window) {
parent.postMessage(JSON.stringify({
desc: document.getElementById("desc").innerHTML,
index: 36,
result: (result ? "passed" : "failed")
}), window.location.href);
}
}
}
hyphenate_fur("Il furlan e je une lenghe romanze de famee des lenghis retichis, che e je fevelade soredut intal Friûl, ma ancje vie pal mont. Cualchi volte al ven clamât Ladin orientâl, parcè che al à diviers ponts in comun cul ladin, ma si è svilupât in un altri mût cul passâ dal timp, sot de influence des lenghis ator dal Friûl");
};
Expand Down
25 changes: 18 additions & 7 deletions testsuite/test37.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,24 @@

window.onload = function () {
function hyphenate_fur(text) {
Hyphenopoly.hyphenators.fur.then(
function (furhyph) {
document.getElementById("test1").innerText = furhyph(text);
assertAll();
}).catch(function(e) {
assertError(e);
});
if (window.Promise) {
Hyphenopoly.hyphenators.fur.then(
function (furhyph) {
document.getElementById("test1").innerText = furhyph(text);
assertAll();
}).catch(function(e) {
assertError(e);
});
} else {
result = false
if (parent != window) {
parent.postMessage(JSON.stringify({
desc: document.getElementById("desc").innerHTML,
index: 37,
result: (result ? "passed" : "failed")
}), window.location.href);
}
}
}
hyphenate_fur("Il furlan e je une lenghe romanze de famee des lenghis retichis, che e je fevelade soredut intal Friûl, ma ancje vie pal mont. Cualchi volte al ven clamât Ladin orientâl, parcè che al à diviers ponts in comun cul ladin, ma si è svilupât in un altri mût cul passâ dal timp, sot de influence des lenghis ator dal Friûl");
};
Expand Down
50 changes: 31 additions & 19 deletions testsuite/test38.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,38 @@
};

window.onload = function () {
function hyphenate_en(text) {
Hyphenopoly.hyphenators["en"].then(
function (enhyph) {
document.getElementById("test1").innerText = enhyph(text);
assertAll();
}).catch(function(e) {
assertError(e);
});
}
function hyphenate_de(text) {
Hyphenopoly.hyphenators["de"].then(
function (dehyph) {
document.getElementById("test2").innerText = dehyph(text);
assertAll();
}).catch(function(e) {
assertError(e);
});
if (window.Promise) {
function hyphenate_en(text) {
Hyphenopoly.hyphenators["en"].then(
function (enhyph) {
document.getElementById("test1").innerText = enhyph(text);
assertAll();
}).catch(function(e) {
assertError(e);
});
}
function hyphenate_de(text) {
Hyphenopoly.hyphenators["de"].then(
function (dehyph) {
document.getElementById("test2").innerText = dehyph(text);
assertAll();
}).catch(function(e) {
assertError(e);
});
}
hyphenate_en("hyphenation algorithm");
hyphenate_de("Silbentrennungsalgorithmus");
} else {
result = false
if (parent != window) {
parent.postMessage(JSON.stringify({
desc: document.getElementById("desc").innerHTML,
index: 38,
result: (result ? "passed" : "failed")
}), window.location.href);
}

}
hyphenate_en("hyphenation algorithm");
hyphenate_de("Silbentrennungsalgorithmus");
};

function assertError(e) {
Expand Down

0 comments on commit 5c53a01

Please sign in to comment.