diff --git a/fast_htmlcs/HTMLCS.ts b/fast_htmlcs/HTMLCS.ts
index 73652bd..3fe3516 100755
--- a/fast_htmlcs/HTMLCS.ts
+++ b/fast_htmlcs/HTMLCS.ts
@@ -345,22 +345,8 @@ _global.HTMLCS = new (function () {
// See if the ruleset object is already included (eg. if minified).
const parts = _standard.split("/");
const part = parts[parts.length - 2];
- const ruleSet = _getRuleset(part);
- if (ruleSet) {
- // Already included.
- _registerStandard(_standard, part, callback, failCallback, options);
- } else {
- // TODO: remove _include script callback standard always included
- _includeScript(
- _standard,
- function () {
- // Script is included now register the standard.
- _registerStandard(_standard, part, callback, failCallback, options);
- },
- failCallback
- );
- }
+ _registerStandard(_standard, part, callback, failCallback, options);
};
/**
@@ -464,8 +450,6 @@ _global.HTMLCS = new (function () {
// Already loaded.
if (sniffObj) {
cb();
- } else {
- _includeScript(_getSniffPath(standard, sniff), cb, failCallback);
}
} else {
// Including a whole other standard.
@@ -509,20 +493,6 @@ _global.HTMLCS = new (function () {
}
};
- /**
- * Returns the path to the sniff file.
- *
- * @param {String} standard The name of the standard.
- * @param {String} sniff The name of the sniff.
- *
- * @returns {String} The path to the JS file of the sniff.
- */
- const _getSniffPath = (standard, sniff) => {
- const parts = standard.split("/");
- parts.pop();
- return parts.join("/") + "/Sniffs/" + sniff.replace(/\./g, "/") + ".js";
- };
-
/**
* Returns the path to a local standard.
*
@@ -545,8 +515,10 @@ _global.HTMLCS = new (function () {
const cstandard = _standards.has(standard) && _standards.get(standard); // standard should always exist
let name = "HTMLCS_";
- name += ((cstandard && cstandard.name) || "") + "_Sniffs_";
- name += sniff.split(".").join("_");
+ name +=
+ ((cstandard && cstandard.name) || "") +
+ "_Sniffs_" +
+ sniff.split(".").join("_");
if (!_global[name]) {
return null;
@@ -567,46 +539,4 @@ _global.HTMLCS = new (function () {
*/
const _getMessageCode = (code) =>
_standard + "." + _currentSniff._name + "." + code;
-
- /**
- * Includes the specified JS file.
- *
- * @param {String} src The URL to the JS file.
- * @param {Function} callback The function to call once the script is loaded.
- */
- const _includeScript = (src, callback, failCallback) => {
- const script = document.createElement("script");
-
- script.onload = function () {
- script.onload = null;
- // @ts-ignore
- script.onreadystatechange = null;
- callback.call(this);
- };
-
- script.onerror = function () {
- script.onload = null;
- // @ts-ignore
- script.onreadystatechange = null;
- if (failCallback) {
- failCallback.call(this);
- }
- };
-
- // @ts-ignore
- script.onreadystatechange = function () {
- if (/^(complete|loaded)$/.test(this.readyState) === true) {
- // @ts-ignore
- script.onreadystatechange = null;
- // @ts-ignore
- script.onload();
- }
- };
-
- script.src = src;
-
- document.head
- ? document.head.appendChild(script)
- : document.getElementsByTagName("head")[0].appendChild(script);
- };
})();
diff --git a/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3.ts b/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3.ts
index 77b69be..04ce282 100644
--- a/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3.ts
+++ b/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3.ts
@@ -29,7 +29,7 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3 = {
const required = failure.required;
const recommend = failure.recommendation;
const hasBgImg = failure.hasBgImage || false;
- const hasBgGradient = failure.hasBgGradient || false;
+ const hasBgGradient = failure.hasBgGradient || false;
const isAbsolute = failure.isAbsolute || false;
const hasAlpha = failure.hasAlpha || false;
@@ -47,7 +47,6 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3 = {
Math.pow(10, decimals);
}
-
if (required === 4.5) {
code = "G18";
} else if (required === 3.0) {
@@ -90,10 +89,9 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3 = {
HTMLCS.addMessage(
HTMLCS.WARNING,
element,
- _global.HTMLCS.getTranslation("1_4_3_G18_or_G145.BgGradient").replace(
- /\{\{required\}\}/g,
- required + ""
- ),
+ _global.HTMLCS.getTranslation(
+ "1_4_3_G18_or_G145.BgGradient"
+ ).replace(/\{\{required\}\}/g, required + ""),
code
);
} else if (isAbsolute === true) {
diff --git a/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_Contrast.ts b/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_Contrast.ts
index 7965b09..b4ac669 100644
--- a/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_Contrast.ts
+++ b/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_Contrast.ts
@@ -99,7 +99,10 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3_Contrast = {
bgColour = parentStyle.backgroundColor;
- if (parentStyle.background && parentStyle.background.includes("gradient(")) {
+ if (
+ parentStyle.background &&
+ parentStyle.background.includes("gradient(")
+ ) {
hasBgGradient = true;
break;
}
@@ -126,8 +129,8 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3_Contrast = {
//Make sure it is trying to cover the entire content area
beforeStyle.width == parentStyle.width &&
parseInt(beforeStyle.height, 10) <=
- parseInt(parentStyle.height, 10) &&
- beforeStyle.backgroundImage !== "none"
+ parseInt(parentStyle.height, 10) &&
+ beforeStyle.backgroundImage !== "none"
) {
//And finally it needs a background image
hasBgImg = true;
@@ -147,7 +150,7 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3_Contrast = {
value: undefined,
required: reqRatio,
hasAlpha: false,
- hasBgGradient: true
+ hasBgGradient: true,
});
continue;
} else if (bgColour && bgAlpha < 1.0 && bgAlpha > 0) {
diff --git a/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_6.ts b/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_6.ts
index 793c07b..93a81f7 100644
--- a/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_6.ts
+++ b/fast_htmlcs/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_6.ts
@@ -82,18 +82,17 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_6 = {
".";
}
- if (hasBgGradient === true) {
+ if (hasBgGradient) {
code += ".BgGradient";
HTMLCS.addMessage(
HTMLCS.WARNING,
element,
- _global.HTMLCS.getTranslation("1_4_6_G18_or_G145.BgGradient").replace(
- /\{\{required\}\}/g,
- required + ""
- ),
+ _global.HTMLCS.getTranslation(
+ "1_4_6_G18_or_G145.BgGradient"
+ ).replace(/\{\{required\}\}/g, required + ""),
code
);
- } else if (isAbsolute === true) {
+ } else if (isAbsolute) {
code += ".Abs";
HTMLCS.addMessage(
HTMLCS.WARNING,
@@ -104,7 +103,7 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_6 = {
),
code
);
- } else if (hasBgImg === true) {
+ } else if (hasBgImg) {
code += ".BgImage";
HTMLCS.addMessage(
HTMLCS.WARNING,
diff --git a/fast_htmlcs/Translations/en.ts b/fast_htmlcs/Translations/en.ts
index e080ad3..9ab9b7c 100644
--- a/fast_htmlcs/Translations/en.ts
+++ b/fast_htmlcs/Translations/en.ts
@@ -183,7 +183,7 @@ _global.translation["en"] = {
"This element is absolutely positioned and the background color can not be determined. Ensure the contrast ratio between the text and all covered parts of the background are at least {{required}}:1.",
"1_4_3_G18_or_G145.BgImage":
"This element's text is placed on a background image. Ensure the contrast ratio between the text and all covered parts of the image are at least {{required}}:1.",
- "1_4_3_G18_or_G145.BgGradient":
+ "1_4_3_G18_or_G145.BgGradient":
"This element's text is placed on a gradient. Ensure the contrast ratio between the text and all covered parts of the gradient are at least {{required}}:1.",
"1_4_3_G18_or_G145.Alpha":
"This element's text or background contains transparency. Ensure the contrast ratio between the text and background are at least {{required}}:1.",
diff --git a/fast_htmlcs/Translations/nl.ts b/fast_htmlcs/Translations/nl.ts
index 526e5fe..74ab1aa 100644
--- a/fast_htmlcs/Translations/nl.ts
+++ b/fast_htmlcs/Translations/nl.ts
@@ -233,7 +233,7 @@ _global.translation["nl"] = {
//1_4_3.js
"1_4_3_G18_or_G145.Abs":
"Dit element is absoluut gepositioneerd en de achtergrondkleur kan niet bepaald worden. Zorg ervoor dat de contrastverhouding tussen de tekst en alle bedekte delen van de achtergond minstens {{required}}:1 is.",
- "1_4_3_G18_or_G145.BgImage":
+ "1_4_3_G18_or_G145.BgImage":
"De tekst van dit element werd geplaatst op een achtergrondafbeelding. Zorg ervoor dat de contrastverhouding tussen de tekst en alle bedekte delen van de achtergrondafbeelding minstens {{required}}:1 is.",
"1_4_3_G18_or_G145.BgGradient":
"De tekst van dit element is op een achtergrondverloop geplaatst. Zorg ervoor dat de contrastverhouding tussen de tekst en alle bedekte delen van het achtergrondverloop minimaal {{vereist}}:1 is.",
diff --git a/fast_htmlcs/Translations/pl.ts b/fast_htmlcs/Translations/pl.ts
index dad4117..9f0ff45 100755
--- a/fast_htmlcs/Translations/pl.ts
+++ b/fast_htmlcs/Translations/pl.ts
@@ -234,10 +234,10 @@ _global.translation["pl"] = {
//1_4_3.js
"1_4_3_G18_or_G145.Abs":
"Ten element jest pozycjonowany absolutnie i nie jest możliwe zweryfikowanie jego kontrastu. Sprawdź, czy kontrast jest na wystarczającym poziomie: {{required}}:1.",
- "1_4_3_G18_or_G145.BgImage":
+ "1_4_3_G18_or_G145.BgImage":
"Tekst elementu wyświetlany jest na obrazku. Należy upewnić się, że stosunek kontrastu tekstu do tła wynosi co najmniej {{required}}:1.",
"1_4_3_G18_or_G145.BgGradient":
- "Tekst tego elementu jest umieszczony na gradiencie. Upewnij się, że współczynnik kontrastu między tekstem a wszystkimi zakrytymi częściami gradientu wynosi co najmniej {{required}}:1.",
+ "Tekst tego elementu jest umieszczony na gradiencie. Upewnij się, że współczynnik kontrastu między tekstem a wszystkimi zakrytymi częściami gradientu wynosi co najmniej {{required}}:1.",
"1_4_3_G18_or_G145.Alpha":
"Tekst lub tło tego elementu jest przezroczyste. Upewnij się, że współczynnik kontrastu między tekstem a tłem wynosi co najmniej {{required}}:1.",
"1_4_3_G18_or_G145.Fail":
diff --git a/fast_htmlcs/package.json b/fast_htmlcs/package.json
index ee05ec9..7024546 100644
--- a/fast_htmlcs/package.json
+++ b/fast_htmlcs/package.json
@@ -1,6 +1,6 @@
{
"name": "fast_htmlcs",
- "version": "0.0.69",
+ "version": "0.0.70",
"description": "A high performance fork of HTML_CodeSniffer.",
"license": "BSD-3-Clause",
"main": "index.js",
diff --git a/kayle/package.json b/kayle/package.json
index 7d3a454..992ffca 100644
--- a/kayle/package.json
+++ b/kayle/package.json
@@ -1,6 +1,6 @@
{
"name": "kayle",
- "version": "0.8.6",
+ "version": "0.8.7",
"description": "Extremely fast and accurate accessibility engine built for any headless tool like playwright or puppeteer.",
"main": "./build/index.js",
"keywords": [