aboutsummaryrefslogtreecommitdiff
path: root/guidelines/WCAG-1.0/guideline-1.js
diff options
context:
space:
mode:
Diffstat (limited to 'guidelines/WCAG-1.0/guideline-1.js')
-rw-r--r--guidelines/WCAG-1.0/guideline-1.js27
1 files changed, 7 insertions, 20 deletions
diff --git a/guidelines/WCAG-1.0/guideline-1.js b/guidelines/WCAG-1.0/guideline-1.js
index 61e1384..ebbd823 100644
--- a/guidelines/WCAG-1.0/guideline-1.js
+++ b/guidelines/WCAG-1.0/guideline-1.js
@@ -3,7 +3,7 @@
*/
exports.name = "Equivalent Alternatives";
-exports.description = "";
+exports.description = "Web Accessibility Guideline: Provide equivalent alternatives to auditory and visual content";
exports.rule = function(report) {
@@ -11,21 +11,21 @@ exports.rule = function(report) {
/* Checkpoint 1.1 [Priority 1] **********************************************/
var hasAlt = function(ix) {
- // TODO: strip space from the alt attribute to prevent ' ' from passing
- // the test
- if(_.isEmpty($(this).attr('alt')) && _.isEmpty($(this).attr('longdesc'))) {
+ var alt = $.trim($(this).attr('alt'));
+ var longdesc = $.trim($(this).attr('longdesc'));
+ if(_.isEmpty(alt) && _.isEmpty(longdesc)) {
report.error('No alt/longdesc specified', this);
}
};
var hasText = function(ix) {
- // TODO: strip space from the text to prevent ' ' from passing the test
- if(_.isEmpty($(this).text())) {
+ if(_.isEmpty($.trim($(this).text()))) {
report.error('No text node', this);
}
};
// images with semantic meaning should have an alt attribute.
+ // TODO add a heuristic for detecting large images
$5('a').find('img')
.add($5('dl').find('img'))
.add($5('dd').find('img'))
@@ -40,8 +40,6 @@ exports.rule = function(report) {
// All `object` tags must have a text node
$5('object').each(hasText).each(hasAlt);
- // TODO: what's the best way to classify content that's `complex`?
-
// All `area` elements of an image map should have alt attributes. It's also a
// bit overzealous, as it looks at all maps, not just maps that are referenced
// from images.
@@ -62,23 +60,12 @@ exports.rule = function(report) {
// everything that the server does. It's more of a sanity check, that this
// has been thought of.
$5('img').filter('[ismap]').each(function(ix) {
- if(_.isEmpty($(this).attr('usemap'))) {
+ if(_.isEmpty($.trim($(this).attr('usemap')))) {
report.error('No usemap attribute to supplement a use of ismap', this);
}
});
- /* Checkpoint 1.3 [Priority 1] **********************************************/
-
- // TODO: Not really sure if this is something that we can check; the guideline
- // seems to be more of a subjective check.
-
-
- /* Checkpoint 1.4 [Priority 1] **********************************************/
-
- // TODO: Again, not sure if this is something we can check here.
-
-
/* Checkpoint 1.5 [Priority 3] **********************************************/
// Make sure that every link in an image map has a corresponding text link