diff options
author | Trevor Elliott <trevor@galois.com> | 2013-07-15 15:26:00 -0700 |
---|---|---|
committer | Trevor Elliott <trevor@galois.com> | 2013-07-15 15:26:00 -0700 |
commit | bca26d5a785f2c41d4d223ee049465b7be361154 (patch) | |
tree | ddeec68d4b377bebf644150d93b0e5bafc124477 /guidelines/WCAG-1.0/guideline-5.js | |
parent | 2618fb0c74567b42ec238706132937f087f8fc06 (diff) | |
parent | 265f160e55d98b37aa8d8f9b16a1a5ccb32bdb0d (diff) |
Merge remote-tracking branch 'origin/master' into new-ui
Diffstat (limited to 'guidelines/WCAG-1.0/guideline-5.js')
-rw-r--r-- | guidelines/WCAG-1.0/guideline-5.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/guidelines/WCAG-1.0/guideline-5.js b/guidelines/WCAG-1.0/guideline-5.js new file mode 100644 index 0000000..48feb49 --- /dev/null +++ b/guidelines/WCAG-1.0/guideline-5.js @@ -0,0 +1,34 @@ +exports.name = "WCAG 1.0 Guideline 5: Tables"; +exports.description = "Web Accessibility Guideline: Create tables that transform gracefully"; +exports.rule = function(report) { + + /* Checkpoint 5.1 *********************************************************** + * + * For data tables, identify row and column headers. + */ + + $('table').each(function () { + if ($(this).find('th').length == 0) { + report.error('Table does not have column headers <TH>', this); + } + }); + + + /* Checkpoint 5.5 *********************************************************** + * + * Provide summaries for tables. + */ + + $('table').each(function () { + var $cap = $(this).find('caption'); + var title = $.trim($(this).attr('title')); + var sum = $.trim($(this).attr('summary')); + if ($cap.length == 0 && (title === undefined || title == '')) { + report.error('Table has no caption or title attribute', this); + } + if (sum === undefined || sum == '') { + report.error('Table has no summary attribute', this); + } + }); + +}; |