aboutsummaryrefslogtreecommitdiff
path: root/guidelines
diff options
context:
space:
mode:
authorGravatar Benjamin Jones <bjones@galois.com>2013-07-16 17:42:02 -0700
committerGravatar Benjamin Jones <bjones@galois.com>2013-07-16 17:42:02 -0700
commit2e6d0ca2638f34ffb96b0f5bf98e6545b8abefbb (patch)
treec2e4d0410ed5c63fdf603808d56138d6f98c26f8 /guidelines
parente089832e50c87a79a9872009fd47231473d81b7a (diff)
refactoring
Diffstat (limited to 'guidelines')
-rw-r--r--guidelines/WCAG-1.0/guideline-5.js34
1 files changed, 19 insertions, 15 deletions
diff --git a/guidelines/WCAG-1.0/guideline-5.js b/guidelines/WCAG-1.0/guideline-5.js
index 48feb49..c8decd7 100644
--- a/guidelines/WCAG-1.0/guideline-5.js
+++ b/guidelines/WCAG-1.0/guideline-5.js
@@ -7,28 +7,32 @@ exports.rule = function(report) {
* 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);
- }
+ $5('table').noSubElt('th').each(function () {
+ 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);
- }
+ $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);
});
};