diff options
author | Trevor Elliott <trevor@galois.com> | 2013-06-26 10:50:51 -0700 |
---|---|---|
committer | Trevor Elliott <trevor@galois.com> | 2013-06-26 10:50:51 -0700 |
commit | 9c27c7e281a54e8819d256b7ac054f77cf957631 (patch) | |
tree | cd899cc91d57b3315ae08f86fa2241a1b63b87ce /guidelines/accessibility/guideline-2.js | |
parent | 83fd5d7eac15eda9ffcedf1d60dfeeadc722e24c (diff) |
Rename the accessibility directory
* Accessibility was too general, these were only WCAG-1.0
Diffstat (limited to 'guidelines/accessibility/guideline-2.js')
-rw-r--r-- | guidelines/accessibility/guideline-2.js | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/guidelines/accessibility/guideline-2.js b/guidelines/accessibility/guideline-2.js deleted file mode 100644 index 7dcf28d..0000000 --- a/guidelines/accessibility/guideline-2.js +++ /dev/null @@ -1,43 +0,0 @@ -exports.name = "colorDifference"; -exports.description = "Elements should provide sufficient color difference"; -exports.rule = function(report) { - - /* Checkpoint 2.1 ***********************************************************/ - - // TODO: not sure about the best way to test that information isn't hidden - // when colors go away. - - - /* Checkpoint 2.2 ***********************************************************/ - - var fc = fiveui.color; - var MIN_COLOR_DIFF = 500; // http://www.w3.org/TR/2000/WD-AERT-20000426#color - - /** - * Return the absolute "color difference" between two * given RGB color - * objects. - * Input is two RGB color objects. - */ - var colorDiff = function (c1, c2) { - return Math.abs(c1.r - c2.r) + - Math.abs(c1.g - c2.g) + - Math.abs(c1.b - c2.b); - }; - - fiveui.query('*') - .filter(function () { // filter for lowest level elts having non-empty text - var $this = $(this); - return $this.children().length == 0 && $.trim($this.text()).length > 0; - }) - .each(function (i) { - // TODO take into account fg alpha values - var fg = fc.colorToRGB($(this).css('color')); - var bg = fc.findBGColor($(this)); - if (fg && bg) { - var diff = colorDiff(fg, bg); - if (diff < MIN_COLOR_DIFF) { - report.error('Element has poor color difference: ' + diff, this); - } - } - }); -}; |