diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3c75e44f..296f83ba 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,14 @@
# Version History
+## Version 3.1.0 (2019-04-28)
+### Fixed
+* Correctly reject hyphenator promises (issue#77)
+* performance: reduce file size of Hyphenopoly_Loader.js
+* update devDependencies
+
+### Added
+* feature: get maindir and patterndir from currentScript
+
## Version 3.0.2 (2019-04-28)
### Security
* refactor(Loader): don't use innerHTML
diff --git a/Hyphenopoly.js b/Hyphenopoly.js
index 323d555d..17038a75 100644
--- a/Hyphenopoly.js
+++ b/Hyphenopoly.js
@@ -1,5 +1,5 @@
/**
- * @license Hyphenopoly 3.0.2 - client side hyphenation for webbrowsers
+ * @license Hyphenopoly 3.1.0 - client side hyphenation for webbrowsers
* ©2019 Mathias Nater, Zürich (mathiasnater at gmail dot com)
* https://github.com/mnater/Hyphenopoly
*
@@ -8,7 +8,6 @@
*/
/* globals asmHyphenEngine, Hyphenopoly */
-
(function mainWrapper(w) {
"use strict";
const SOFTHYPHEN = String.fromCharCode(173);
@@ -334,12 +333,12 @@
isChild = isChild || false;
const eLang = getElementLanguage(el, pLang);
/* eslint-disable security/detect-object-injection */
- if (H.clientFeat.langs[eLang] === "H9Y") {
+ if (H.cf.langs[eLang] === "H9Y") {
elements.add(el, eLang, sel);
if (!isChild && C.safeCopy) {
registerOnCopy(el);
}
- } else if (!H.clientFeat.langs[eLang]) {
+ } else if (!H.cf.langs[eLang]) {
H.events.dispatch("error", {
"lvl": "warn",
"msg": "Element with '" + eLang + "' found, but '" + eLang + ".hpb' not loaded. Check language tags!"
@@ -748,10 +747,10 @@
*/
function calculateHeapSize(targetSize) {
/* eslint-disable no-bitwise */
- if (H.clientFeat.wasm) {
+ 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;
}
@@ -896,7 +895,7 @@
*/
function encloseHyphenateFunction(baseData, hyphenateFunc) {
/* eslint-disable no-bitwise */
- const heapBuffer = H.clientFeat.wasm
+ const heapBuffer = H.cf.wasm
? baseData.wasmMemory.buffer
: baseData.heapBuffer;
const wordStore = (new Uint16Array(heapBuffer)).subarray(
@@ -940,7 +939,7 @@
* @returns {undefined}
*/
function instantiateWasmEngine(lang) {
- Promise.all([H.binaries.get(lang), H.binaries.get("hyphenEngine")]).then(
+ Promise.all([H.bins.get(lang), H.bins.get("hyphenEngine")]).then(
function onAll(binaries) {
const hpbBuf = binaries[0];
const baseData = calculateBaseData(hpbBuf);
@@ -995,7 +994,7 @@
* @returns {undefined}
*/
function instantiateAsmEngine(lang) {
- const hpbBuf = H.binaries.get(lang);
+ const hpbBuf = H.bins.get(lang);
const baseData = calculateBaseData(hpbBuf);
const specMem = H.specMems.get(lang);
const heapBuffer = (specMem.byteLength >= baseData.hs)
@@ -1095,7 +1094,7 @@
false
);
- H.events.define(
+ H.events.addListener(
"loadError",
function onLoadError(e) {
if (e.msg !== "wasm") {
diff --git a/Hyphenopoly_Loader.js b/Hyphenopoly_Loader.js
index 13a6fda6..ebed7641 100644
--- a/Hyphenopoly_Loader.js
+++ b/Hyphenopoly_Loader.js
@@ -1,5 +1,5 @@
/**
- * @license Hyphenopoly_Loader 3.0.2 - client side hyphenation
+ * @license Hyphenopoly_Loader 3.1.0 - client side hyphenation
* ©2019 Mathias Nater, Zürich (mathiasnater at gmail dot com)
* https://github.com/mnater/Hyphenopoly
*
@@ -9,17 +9,28 @@
/* global Hyphenopoly */
-(function H9YL() {
+/**
+ * Wrap all code in an iife to keep a scope. Important objects are parameters
+ * of this iife to keep codesize low.
+ * @param {Object} w shorthand for window
+ * @param {Object} d shorthand for document
+ * @param {Object} H shorthand for Hyphenopoly
+ * @param {Object} o shorthand for object
+ */
+(function H9YL(w, d, H, o) {
"use strict";
- const d = document;
- const H = Hyphenopoly;
+
+ const store = sessionStorage;
+ const wa = w.WebAssembly;
+ const lcFallbacks = new Map();
+ const lcRequire = new Map();
/**
* Create Object without standard Object-prototype
* @returns {Object} empty object
*/
function empty() {
- return Object.create(null);
+ return o.create(null);
}
@@ -30,36 +41,50 @@
* @returns {undefined}
*/
function eachKey(obj, fn) {
- Object.keys(obj).forEach(fn);
+ o.keys(obj).forEach(fn);
}
+ /**
+ * Set H.cf (Hyphenopoly.clientFeatures) either by reading out previously
+ * computed settings from sessionStorage or creating an template object.
+ * This is in an iife to keep complexity low.
+ */
(function configFeat() {
- // Set H.clientFeat (either from sessionStorage or empty)
- if (H.cacheFeatureTests && sessionStorage.getItem("Hyphenopoly_Loader")) {
- H.clientFeat = JSON.parse(sessionStorage.getItem("Hyphenopoly_Loader"));
+ if (H.cacheFeatureTests && store.getItem("Hyphenopoly_Loader")) {
+ H.cf = JSON.parse(store.getItem("Hyphenopoly_Loader"));
} else {
- H.clientFeat = {
+ H.cf = {
"langs": empty(),
"polyfill": false,
"wasm": null
};
}
}());
+
+ /**
+ * Set H.paths defaults or overwrite with user settings.
+ * This is in an iife to keep complexity low.
+ */
(function configPaths() {
- // Set defaults for paths and setup
- H.dfltPaths = Object.create({
- "maindir": "../Hyphenopoly/",
- "patterndir": "../Hyphenopoly/patterns/"
- });
+ const maindir = (d.currentScript)
+ ? d.currentScript.src.replace(/Hyphenopoly_Loader.js/i, "")
+ : "../";
+ const patterndir = maindir + "patterns/";
if (H.paths) {
- if (H.paths.patterndir) {
- H.dfltPaths.patterndir = H.paths.patterndir;
- }
- if (H.paths.maindir) {
- H.dfltPaths.maindir = H.paths.maindir;
- }
+ H.paths.maindir = H.paths.maindir || maindir;
+ H.paths.patterndir = H.paths.patterndir || patterndir;
+ } else {
+ H.paths = o.create({
+ "maindir": maindir,
+ "patterndir": patterndir
+ });
}
}());
+
+ /**
+ * Set some H.setup fields to defaults or overwrite with user settings.
+ * This is in an iife to keep complexity low.
+ */
(function configSetup() {
if (H.setup) {
H.setup.selectors = H.setup.selectors || {".hyphenate": {}};
@@ -73,26 +98,36 @@
};
}
}());
+
+ /**
+ * Copy required languages to local lcRequire and
+ * eventually fallbacks to local lcFallbacks.
+ * This is in an iife to keep complexity low.
+ */
(function configRequire() {
- H.lcRequire = new Map();
eachKey(H.require, function copyRequire(k) {
- /* eslint-disable security/detect-object-injection */
- H.lcRequire.set(k.toLowerCase(), H.require[k]);
- /* eslint-enable security/detect-object-injection */
+ // eslint-disable-next-line security/detect-object-injection
+ lcRequire.set(k.toLowerCase(), H.require[k]);
});
if (H.fallbacks) {
- H.lcFallbacks = new Map();
eachKey(H.fallbacks, function copyFallbacks(k) {
- /* eslint-disable security/detect-object-injection */
- H.lcFallbacks.set(
+ lcFallbacks.set(
k.toLowerCase(),
+ // eslint-disable-next-line security/detect-object-injection
H.fallbacks[k].toLowerCase()
);
- /* eslint-enable security/detect-object-injection */
});
}
}());
+ /**
+ * Define function H.toggle.
+ * This function hides or unhides (depending of the parameter state)
+ * the whole document (H.setup.hide == "all") or
+ * each selected element (H.setup.hide == "element") or
+ * text of each selected element (H.setup.hide == "text")
+ * @param {string} state State: either on (visible) or off (hidden)
+ */
H.toggle = function toggle(state) {
if (state === "on") {
const stylesNode = d.getElementById("H9Y_Styles");
@@ -121,11 +156,16 @@
default:
myStyle = "";
}
- sc.appendChild(document.createTextNode(myStyle));
- d.getElementsByTagName("head")[0].appendChild(sc);
+ sc.appendChild(d.createTextNode(myStyle));
+ d.head.appendChild(sc);
}
};
+ /**
+ * Setup basic event system. Some events are defined but the definition of
+ * what happens when they are triggered is deferred to Hyphenopoly.js
+ * This is in an iife to keep complexity low.
+ */
(function setupEvents() {
// Events known to the system
const definedEvents = new Map();
@@ -157,7 +197,7 @@
"timeout",
function def(e) {
H.toggle("on");
- window.console.info(
+ w.console.info(
"Hyphenopolys 'FOUHC'-prevention timed out after %dms",
e.delay
);
@@ -170,13 +210,13 @@
function def(e) {
switch (e.lvl) {
case "info":
- window.console.info(e.msg);
+ w.console.info(e.msg);
break;
case "warn":
- window.console.warn(e.msg);
+ w.console.warn(e.msg);
break;
default:
- window.console.error(e.msg);
+ w.console.error(e.msg);
}
},
true
@@ -222,7 +262,8 @@
"data": e,
"name": "loadError"
});
- }
+ },
+ false
);
define(
@@ -301,60 +342,29 @@
}());
/**
- * Test if wasm is supported
- * @returns {undefined}
+ * Feature test for wasm.
+ * @returns {boolean} support
*/
- function featureTestWasm() {
- /* eslint-disable no-prototype-builtins */
- /**
- * Feature test for wasm
- * @returns {boolean} support
+ function runWasmTest() {
+ /*
+ * Wasm feature test with iOS bug detection
+ * (https://bugs.webkit.org/show_bug.cgi?id=181781)
*/
- function runWasmTest() {
- /*
- * This is the original test, without webkit workaround
- * if (typeof WebAssembly === "object" &&
- * typeof WebAssembly.instantiate === "function") {
- * const module = new WebAssembly.Module(Uint8Array.from(
- * [0, 97, 115, 109, 1, 0, 0, 0]
- * ));
- * if (WebAssembly.Module.prototype.isPrototypeOf(module)) {
- * return WebAssembly.Instance.prototype.isPrototypeOf(
- * new WebAssembly.Instance(module)
- * );
- * }
- * }
- * return false;
- */
-
- /*
- * Wasm feature test with iOS bug detection
- * (https://bugs.webkit.org/show_bug.cgi?id=181781)
- */
- if (
- typeof WebAssembly === "object" &&
- typeof WebAssembly.instantiate === "function"
- ) {
- /* eslint-disable array-element-newline */
- const module = new WebAssembly.Module(Uint8Array.from([
- 0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 127, 1, 127,
- 3, 2, 1, 0, 5, 3, 1, 0, 1, 7, 8, 1, 4, 116, 101, 115,
- 116, 0, 0, 10, 16, 1, 14, 0, 32, 0, 65, 1, 54, 2, 0, 32,
- 0, 40, 2, 0, 11
- ]));
- /* eslint-enable array-element-newline */
- if (WebAssembly.Module.prototype.isPrototypeOf(module)) {
- const inst = new WebAssembly.Instance(module);
- return WebAssembly.Instance.prototype.isPrototypeOf(inst) &&
- (inst.exports.test(4) !== 0);
- }
- }
- return false;
- }
- /* eslint-enable no-prototype-builtins */
- if (H.clientFeat.wasm === null) {
- H.clientFeat.wasm = runWasmTest();
+ if (
+ typeof wa === "object" &&
+ typeof wa.Instance === "function"
+ ) {
+ /* eslint-disable array-element-newline */
+ const module = new wa.Module(Uint8Array.from([
+ 0, 97, 115, 109, 1, 0, 0, 0, 1, 6, 1, 96, 1, 127, 1, 127,
+ 3, 2, 1, 0, 5, 3, 1, 0, 1, 7, 8, 1, 4, 116, 101, 115,
+ 116, 0, 0, 10, 16, 1, 14, 0, 32, 0, 65, 1, 54, 2, 0, 32,
+ 0, 40, 2, 0, 11
+ ]));
+ /* eslint-enable array-element-newline */
+ return (new wa.Instance(module).exports.test(4) !== 0);
}
+ return false;
}
/**
@@ -363,7 +373,7 @@
* @param {string} filename Filename of the script
* @returns {undefined}
*/
- function scriptLoader(path, filename) {
+ function loadScript(path, filename) {
const script = d.createElement("script");
script.src = path + filename;
if (filename === "hyphenEngine.asm.js") {
@@ -385,7 +395,7 @@
* @param {Object} msg Message
* @returns {undefined}
*/
- function binLoader(path, fne, name, msg) {
+ function loadBinary(path, fne, name, msg) {
/**
* Get bin file using fetch
* @param {string} p Where the script is stored
@@ -395,46 +405,41 @@
* @returns {undefined}
*/
function fetchBinary(p, f, n, m) {
- if (!loadedBins.has(f)) {
- loadedBins.set(f, [m]);
- window.fetch(p + f).then(
- function resolve(response) {
- if (response.ok) {
- if (n === "hyphenEngine") {
- H.binaries.set(n, response.arrayBuffer().then(
- function getModule(buf) {
- return new WebAssembly.Module(buf);
- }
- ));
- H.events.dispatch("engineLoaded", {"msg": m});
- } else {
- const files = loadedBins.get(f);
- files.forEach(function eachHpb(rn) {
- H.binaries.set(
- rn,
- (files.length > 1)
- ? response.clone().arrayBuffer()
- : response.arrayBuffer()
- );
- H.events.dispatch(
- "hpbLoaded",
- {"msg": rn}
- );
- });
- }
+ w.fetch(p + f).then(
+ function resolve(response) {
+ if (response.ok) {
+ if (n === "hyphenEngine") {
+ H.bins.set(n, response.arrayBuffer().then(
+ function getModule(buf) {
+ return new wa.Module(buf);
+ }
+ ));
+ H.events.dispatch("engineLoaded", {"msg": m});
} else {
- H.events.dispatch("loadError", {
- "file": f,
- "msg": m,
- "name": n,
- "path": p
+ const files = loadedBins.get(f);
+ files.forEach(function eachHpb(rn) {
+ H.bins.set(
+ rn,
+ (files.length > 1)
+ ? response.clone().arrayBuffer()
+ : response.arrayBuffer()
+ );
+ H.events.dispatch(
+ "hpbLoaded",
+ {"msg": rn}
+ );
});
}
+ } else {
+ H.events.dispatch("loadError", {
+ "file": f,
+ "msg": m,
+ "name": n,
+ "path": p
+ });
}
- );
- } else if (n !== "hyphenEngine") {
- loadedBins.get(f).push(m);
- }
+ }
+ );
}
/**
@@ -447,42 +452,42 @@
*/
function requestBinary(p, f, n, m) {
/* eslint-disable-next-line no-negated-condition */
- if (!loadedBins.has(f)) {
- loadedBins.set(f, [m]);
- const xhr = new XMLHttpRequest();
- xhr.onload = function onload() {
- if (xhr.statusText === "OK") {
- loadedBins.get(f).
- forEach(function eachHpb(rn) {
- H.binaries.set(
- rn,
- xhr.response
- );
- H.events.dispatch(
- "hpbLoaded",
- {"msg": rn}
- );
- });
- } else {
- H.events.dispatch("loadError", {
- "file": f,
- "msg": m,
- "name": n,
- "path": p
+ const xhr = new XMLHttpRequest();
+ xhr.onload = function onload() {
+ if (xhr.status === 200) {
+ loadedBins.get(f).
+ forEach(function eachHpb(rn) {
+ H.bins.set(
+ rn,
+ xhr.response
+ );
+ H.events.dispatch(
+ "hpbLoaded",
+ {"msg": rn}
+ );
});
- }
- };
- xhr.open("GET", p + f);
- xhr.responseType = "arraybuffer";
- xhr.send();
+ } else {
+ H.events.dispatch("loadError", {
+ "file": f,
+ "msg": m,
+ "name": n,
+ "path": p
+ });
+ }
+ };
+ xhr.open("GET", p + f);
+ xhr.responseType = "arraybuffer";
+ xhr.send();
+ }
+ if (!loadedBins.has(fne)) {
+ loadedBins.set(fne, [msg]);
+ if (H.cf.wasm) {
+ fetchBinary(path, fne, name, msg);
} else {
- loadedBins.get(f).push(m);
+ requestBinary(path, fne, name, msg);
}
- }
- if (H.clientFeat.wasm) {
- fetchBinary(path, fne, name, msg);
- } else {
- requestBinary(path, fne, name, msg);
+ } else if (name !== "hyphenEngine") {
+ loadedBins.get(fne).push(msg);
}
}
@@ -500,49 +505,39 @@
);
const wasmPages = specVal.get(lang) || 32;
H.specMems = H.specMems || new Map();
- if (H.clientFeat.wasm) {
- H.specMems.set(lang, new WebAssembly.Memory({
+ if (H.cf.wasm) {
+ H.specMems.set(lang, new wa.Memory({
"initial": wasmPages,
"maximum": 256
}));
} else {
- /**
- * Polyfill Math.log2
- * @param {number} x argument
- * @return {number} Log2(x)
- */
- Math.log2 = Math.log2 || function polyfillLog2(x) {
- return Math.log(x) * Math.LOG2E;
- };
/* eslint-disable no-bitwise */
- const asmPages = (2 << Math.floor(Math.log2(wasmPages))) * 65536;
+ const asmPages = (2 << Math.floor(
+ Math.log(wasmPages) * Math.LOG2E
+ )) << 16;
/* eslint-enable no-bitwise */
H.specMems.set(lang, new ArrayBuffer(asmPages));
}
}
- (function featureTestCSSHyphenation() {
+ (function testClientFeatures() {
const tester = (function tester() {
let fakeBody = null;
-
- const css = (function createCss() {
- /* eslint-disable array-element-newline */
- const props = [
- "visibility:hidden;",
- "-moz-hyphens:auto;",
- "-webkit-hyphens:auto;",
- "-ms-hyphens:auto;",
- "hyphens:auto;",
- "width:48px;",
- "font-size:12px;",
- "line-height:12px;",
- "border:none;",
- "padding:0;",
- "word-wrap:normal"
- ];
- /* eslint-enable array-element-newline */
- return props.join("");
- }());
+ /* eslint-disable array-element-newline */
+ const css = [
+ "visibility:hidden;",
+ "-moz-hyphens:auto;",
+ "-webkit-hyphens:auto;",
+ "-ms-hyphens:auto;",
+ "hyphens:auto;",
+ "width:48px;",
+ "font-size:12px;",
+ "line-height:12px;",
+ "border:none;",
+ "padding:0;",
+ "word-wrap:normal"
+ ].join("");
+ /* eslint-enable array-element-newline */
/**
* Create and append div with CSS-hyphenated word
@@ -551,16 +546,15 @@
*/
function create(lang) {
/* eslint-disable security/detect-object-injection */
- if (H.clientFeat.langs[lang]) {
+ if (H.cf.langs[lang]) {
return;
}
/* eslint-enable security/detect-object-injection */
fakeBody = fakeBody || d.createElement("body");
const testDiv = d.createElement("div");
testDiv.lang = lang;
- testDiv.id = lang;
testDiv.style.cssText = css;
- testDiv.appendChild(d.createTextNode(H.lcRequire.get(lang)));
+ testDiv.appendChild(d.createTextNode(lcRequire.get(lang)));
fakeBody.appendChild(testDiv);
}
@@ -623,18 +617,27 @@
/* eslint-disable security/detect-object-injection */
H.hyphenators = H.hyphenators || empty();
if (!H.hyphenators[lang]) {
- if (window.Promise) {
+ if (w.Promise) {
H.hyphenators[lang] = new Promise(function pro(rs, rj) {
H.events.addListener("engineReady", function handler(e) {
if (e.msg === lang) {
rs(H.createHyphenator(e.msg));
}
}, true);
- H.events.addListener("error", function handler(e) {
- if (e.key === lang || e.key === "hyphenEngine") {
- rj(e.msg);
+ H.events.addListener("loadError", function handler(e) {
+ if (e.name === lang || e.name === "hyphenEngine") {
+ rj(new Error("File " + e.file + " can't be loaded from " + e.path));
}
- }, true);
+ }, false);
+ });
+ H.hyphenators[lang].catch(function catchPromiseError(e) {
+ H.events.dispatch(
+ "error",
+ {
+ "lvl": "error",
+ "msg": e.message
+ }
+ );
});
} else {
H.hyphenators[lang] = {
@@ -646,7 +649,7 @@
"then": function () {
H.events.dispatch(
"error",
- {"msg": "Promises not supported in this engine. Use a polyfill (e.g. https://github.com/taylorhakes/promise-polyfill)!"}
+ {"msg": "Promises not supported in this engine. Use a polyfill."}
);
}
};
@@ -656,72 +659,67 @@
}
/**
- * Load all ressources for a required " + i + " passed (CSS) " + i + " passed (CSS) Die Worttrennung, auch Silbentrennung genannt, bezeichnet in der Orthographie die Art und Weise, wie die Wörter insbesondere am Zeilenende getrennt werden können. Die Wort|tren|nung, auch Sil|ben|tren|nung ge|nannt, be|zeich|net in der Or|tho|gra|phie die Art und Weise, wie die Wör|ter ins|be|son|de|re am Zei|len|en|de ge|trennt wer|den kön|nen. Die Wort|tren|nung, auch Sil|ben|tren|nung ge|nannt, be|zeich|net in der Or|tho|gra|phie die Art und Weise, wie die Wör|ter ins|be|son|de|re am Zei|len|en|de ge|trennt wer|den kön|nen. Die Worttrennung, auch Silbentrennung genannt, bezeichnet in der Orthographie die Art und Weise, wie die Wörter insbesondere am Zeilenende getrennt werden können. Die Wort|tren|nung, auch Sil|ben|tren|nung ge|nannt, be|zeich|net in der Or|tho|gra|phie die Art und Weise, wie die Wör|ter ins|be|son|de|re am Zei|len|en|de ge|trennt wer|den kön|nen. Die Wort|tren|nung, auch Sil|ben|tren|nung ge|nannt, be|zeich|net in der Or|tho|gra|phie die Art und Weise, wie die Wör|ter ins|be|son|de|re am Zei|len|en|de ge|trennt wer|den kön|nen.4: en-AU (fallback to en-gb)
5: de
6: de-CH (fallback to de)
Reject hyphenator-promise if pattern can't be loaded.
+ +Il fur|lan e je une len|ghe ro|man|ze de fa|mee des len|ghis re|ti|chis, che e je fe|ve|la|de so|re|dut in|tal Friûl, ma an|cje vie pal mont. Cual|chi vol|te al ven clamât La|din orientâl, parcè che al à di|viers ponts in co|mun cul la|din, ma si è svi|lupât in un al|tri mût cul pa|ssâ dal timp, sot de in|fluen|ce des len|ghis ator dal Friûl
+diff --git a/testsuite/test3.html b/testsuite/test3.html index a2b0cdd3..72c4452b 100644 --- a/testsuite/test3.html +++ b/testsuite/test3.html @@ -9,10 +9,6 @@ require: { "en-us": "FORCEHYPHENOPOLY" }, - paths: { - maindir: "../", - patterndir: "../patterns/" - }, handleEvent: { hyphenopolyEnd: function (e) { assert(); diff --git a/testsuite/test30.html b/testsuite/test30.html index 2650e1cc..49997dc5 100644 --- a/testsuite/test30.html +++ b/testsuite/test30.html @@ -8,10 +8,6 @@ require: { "en-us": "FORCEHYPHENOPOLY" }, - paths: { - maindir: "../", - patterndir: "../patterns/" - }, setup: { classnames: { "hyphenopoly": {} diff --git a/testsuite/test31.html b/testsuite/test31.html index ee9dfd5f..2f55ee60 100644 --- a/testsuite/test31.html +++ b/testsuite/test31.html @@ -8,10 +8,6 @@ require: { "de": "FORCEHYPHENOPOLY" }, - paths: { - maindir: "../", - patterndir: "../patterns/" - }, setup: { dontHyphenateClass: "nohyphens", selectors: { diff --git a/testsuite/test32.html b/testsuite/test32.html index ce85254a..0809549e 100644 --- a/testsuite/test32.html +++ b/testsuite/test32.html @@ -53,10 +53,6 @@ "de": "FORCEHYPHENOPOLY", "en-us": "FORCEHYPHENOPOLY" }, - paths: { - maindir: "../", - patterndir: "../patterns/" - }, setup: { selectors: { ".hyphenate": { diff --git a/testsuite/test33.html b/testsuite/test33.html index 7f6f0fa8..53c7b8e8 100644 --- a/testsuite/test33.html +++ b/testsuite/test33.html @@ -12,10 +12,6 @@ fallbacks: { "en-au": "en-us" }, - paths: { - maindir: "../", - patterndir: "../patterns/" - }, setup: { safeCopy: false }, @@ -34,7 +30,7 @@ var lang = ""; while (i <= tests) { lang = document.getElementById("test" + i).lang; - if (Hyphenopoly.clientFeat.langs[lang] === "CSS") { + if (Hyphenopoly.cf.langs[lang] === "CSS") { document.getElementById("result").innerHTML += "
" + i + " passed (CSS)
"; result = result && true; } else { diff --git a/testsuite/test34.html b/testsuite/test34.html index dbf73e31..99cca5dd 100644 --- a/testsuite/test34.html +++ b/testsuite/test34.html @@ -9,10 +9,6 @@ "foobar": "garzabariktimalborsi", "en-us": "FORCEHYPHENOPOLY" }, - paths: { - maindir: "../", - patterndir: "../patterns/" - }, setup: { safeCopy: false, checkRes: true @@ -32,7 +28,7 @@ var lang = ""; while (i <= tests) { lang = document.getElementById("test" + i).lang; - if (Hyphenopoly.clientFeat.langs[lang] === "CSS") { + if (Hyphenopoly.cf.langs[lang] === "CSS") { document.getElementById("result").innerHTML += "
" + i + " passed (CSS)
"; result = result && true; } else { diff --git a/testsuite/test35.html b/testsuite/test35.html index a1713585..2556455f 100644 --- a/testsuite/test35.html +++ b/testsuite/test35.html @@ -8,10 +8,6 @@ require: { "hu": "FORCEHYPHENOPOLY" }, - paths: { - maindir: "../", - patterndir: "../patterns/" - }, setup: { selectors: { ".hyphenate": { diff --git a/testsuite/test36.html b/testsuite/test36.html new file mode 100644 index 00000000..18834639 --- /dev/null +++ b/testsuite/test36.html @@ -0,0 +1,128 @@ + + +
+ +
+ + + + +
+