aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jesse Hallett <jesse@galois.com>2013-12-23 14:02:54 -0800
committerGravatar Jesse Hallett <jesse@galois.com>2013-12-23 14:32:47 -0800
commit62abc5c667896f7af216c4fa6643fc604b8b051f (patch)
tree4bc548ed9b192a690d498897d9463e98c0a23f17
parent43a51d698745361d0ebab7e91439cb4f2806bb1b (diff)
Wikipedia guideline: images should include an alt attribute
-rw-r--r--guidelines/wikipedia/imageAlt.js8
-rw-r--r--guidelines/wikipedia/wikipedia.json1
2 files changed, 9 insertions, 0 deletions
diff --git a/guidelines/wikipedia/imageAlt.js b/guidelines/wikipedia/imageAlt.js
new file mode 100644
index 0000000..c54244d
--- /dev/null
+++ b/guidelines/wikipedia/imageAlt.js
@@ -0,0 +1,8 @@
+exports.name = "Images should include an alt attribute";
+exports.description = "Images should include an alt attribute, even an empty one, that acts as a substitute for the image (for non-visual users).";
+
+exports.rule = function(report) {
+ $5('#mw-content-text img:not([alt])').each(function(i, img) {
+ report.warning("Image has no alt attribute.", img);
+ });
+};
diff --git a/guidelines/wikipedia/wikipedia.json b/guidelines/wikipedia/wikipedia.json
index b7b158e..f53febc 100644
--- a/guidelines/wikipedia/wikipedia.json
+++ b/guidelines/wikipedia/wikipedia.json
@@ -14,5 +14,6 @@
, "pseudoIndent.js"
, "floatSandwiches.js"
, "spaceBetweenListItems.js"
+ , "imageAlt.js"
]
}