forked from squizlabs/HTML_CodeSniffer
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Using HTMLCS.util.colourStrToRGB(bgColour).alpha seems to work as expected:
---
.../WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_Contrast.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_Contrast.js b/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_Contrast.js
index 9e8311b..dd11271 100644
--- a/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_Contrast.js
+++ b/Standards/WCAG2AAA/Sniffs/Principle1/Guideline1_4/1_4_3_Contrast.js
@@ -80,7 +80,7 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3_Contrast = {
}
// Check for a solid background colour.
- while ((bgColour === 'transparent') || (bgColour === 'rgba(0, 0, 0, 0)')) {
+ while ((bgColour === 'transparent') || (HTMLCS.util.colourStrToRGB(bgColour).alpha === 0)) {
if ((!parent) || (!parent.ownerDocument)) {
break;
}
@@ -163,7 +163,7 @@ _global.HTMLCS_WCAG2AAA_Sniffs_Principle1_Guideline1_4_1_4_3_Contrast = {
isAbsolute: true
});
continue;
- } else if ((bgColour === 'transparent') || (bgColour === 'rgba(0, 0, 0, 0)')) {
+ } else if ((bgColour === 'transparent') || (HTMLCS.util.colourStrToRGB(bgColour).alpha === 0)) {
// If the background colour is still transparent, this is probably
// a fragment with which we cannot reliably make a statement about
// contrast ratio. Skip the element.
--
2.51.0Metadata
Metadata
Assignees
Labels
No labels