aboutsummaryrefslogtreecommitdiff
path: root/guidelines/WCAG-1.0/guideline-6.js
blob: 59ec2b7de1056b3c95f90542da0c14e8a45a4e38 (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
39
40
41
42
exports.name        = "WCAG 1.0 Guideline 6: New Technologies";
exports.description = "Web Accessibility Guideline: Ensure that pages featuring new technologies" +
                      "transform gracefully";
exports.rule        = function(report) {

  /*
   * Note: the rules contained in this file check properties of elements that
   * are not supported under HTML5
   */

  /* Checkpoint 6.2 ***********************************************************
   *
   * Ensure that equivalents for dynamic content are updated when the dynamic
   * content changes.
   *
   * In particular, http://www.w3.org/TR/WCAG10-HTML-TECHS/#frame-has-html-src
   * requires that FRAME elements have only HTML documents as their src.
   */

  var isNotHtml = function (s) { return !(/html$/.test(s)); };
  $5('frame,iframe').attrFilter('src', isNotHtml).each(function () {
    report.error('Frame src is not an HTML doc', this);
  });

  /* Note: we can make the same selection as above using only jQuery:
     $('frame,iframe').not('[src$="html"]')  */

  /* Checkpoint 6.3 ***********************************************************
   *
   * Links should not use the `javascript:` target.
   */

  var startsWithJava = function (s) { return /^javascript/.test(s); };
  $5('a').attrFilter('href', startsWithJava).each(function () {
    report.error('link uses `javascript:` target', this);
  });

  /* Note: we can make the same selection as above using only jQuery:
     $('a').filter('[href^="javascript"]')  */

};