aboutsummaryrefslogtreecommitdiff
path: root/guidelines/WCAG-1.0/guideline-5.js
blob: c8decd763bcd982512469d150e807db6ee23d8e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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.
   */

  $5('table').noSubElt('th').each(function () {
    report.error('Table does not have column headers <TH>', this);
  });

  /* Checkpoint 5.5 ***********************************************************
   *
   * Provide summaries for tables.
   */

  $5('table').noSubElt('caption')
             .noAttr('title')
             .each(function () {
    report.warning('Table has no caption or title attribute', this);
  });

  $('table').noAttr('summary').each(function () {
    report.warning('Table has no summary attribute', this);
  });

  /* Checkpoint 5.6 ***********************************************************
   *
   * Provide `abbr` attributes to table headers <TH>
   */

  $5('th').noAttr('abbr').each(function () {
    report.advisory('<TH> has no abbrevation attribute', this);
  });

};