arialinter
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -24,16 +24,24 @@ // Guideline 1.4 Distinguishable | ||
var getInheritedColor = function(dom, that, property) { | ||
dom.$(that).parents().each( function() { | ||
var bc = dom.$(this).css('background-color'); | ||
if (bc === 'transparent') { | ||
return getInheritedColor(dom, this, property); | ||
} else { | ||
return bc; | ||
} | ||
}); | ||
var getInheritedProperty = function(e, property) { | ||
// Is current element's background color set? | ||
var color = e.css(property); | ||
if ((color !== 'rgba(0, 0, 0, 0)') && (color !== 'transparent')) { | ||
// if so then return that color | ||
return color; | ||
} | ||
// if not: are you at the body element? | ||
if (e.is('body')) { | ||
// return known 'false' value | ||
return false; | ||
} else { | ||
// call getBackground with parent item | ||
return getInheritedProperty(e.parent(), property); | ||
} | ||
}; | ||
dom.$('h1').each(function() { | ||
var bg = new Color(dom.$(this).parent().css('background-color')); | ||
var fg = new Color(dom.$(this).css('color')); | ||
var bg = new Color(getInheritedProperty(dom.$(this), 'background-color')); | ||
var fg = new Color(getInheritedProperty(dom.$(this), 'color')); | ||
@@ -44,5 +52,7 @@ var L1 = bg.luminosity(); | ||
var ratio = Math.round((Math.max(L1, L2) + 0.05)/(Math.min(L1, L2) + 0.05)*10)/10; | ||
console.log('Ratio: ' + ratio); | ||
if (ratio <= 3) { | ||
reporter.error(that.message, 0, that.name); | ||
reporter.info(that.message, 0, that.name); | ||
@@ -49,0 +59,0 @@ throw dom.$(this).parent().html(); |
{ | ||
"name": "arialinter", | ||
"description": "AriaLinter provides a simple accesibility linter for HTML documents.", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"homepage": "https://github.com/globant-ui/arialinter", | ||
@@ -6,0 +6,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35937
1052