diff options
author | Benjamin Jones <bjones@galois.com> | 2013-01-02 13:15:11 -0800 |
---|---|---|
committer | Benjamin Jones <bjones@galois.com> | 2013-01-02 13:15:11 -0800 |
commit | 2152b111db76392c08d8d406ae32cc3ae54b8b11 (patch) | |
tree | 5d26e1d0d4e12467176c088214f3944d60097c3a /exampleData/ruleSets | |
parent | 56fabf776a9f64807e675204e03b1795015cdca5 (diff) | |
parent | 5130943d66def581a8d6a084a2b5ffa2c3a1c8b1 (diff) |
Merge branch 'master' of src.galois.com:/srv/git/FiveUI
Diffstat (limited to 'exampleData/ruleSets')
-rw-r--r-- | exampleData/ruleSets/colorRules.json | 2 | ||||
-rw-r--r-- | exampleData/ruleSets/imageRules.json | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/exampleData/ruleSets/colorRules.json b/exampleData/ruleSets/colorRules.json index 1cea5a0..1aebf19 100644 --- a/exampleData/ruleSets/colorRules.json +++ b/exampleData/ruleSets/colorRules.json @@ -33,7 +33,7 @@ .cssIsNot("background-color", allow, fiveui.color.colorToHex) .each(function (i, elt) { var color = fiveui.color.colorToHex($(elt).css("background-color")); - report("non-standard background color: " + color, elt); + report("non-standard background color: " + color, $(elt)); }); } }, diff --git a/exampleData/ruleSets/imageRules.json b/exampleData/ruleSets/imageRules.json index 05814f9..40d9081 100644 --- a/exampleData/ruleSets/imageRules.json +++ b/exampleData/ruleSets/imageRules.json @@ -17,12 +17,12 @@ , 'rule': function() { var elt = $5("div[id=header]"); // get the div with id=header - var b = elt.css("background"); // get its background CSS property + var b = $5(elt).css("background"); // get its background CSS property var l = $5("a[href]", elt).prop("href"); // get the <a href=...> string inside the div if (/banner\.gif/.test(b)) { report("banner.gif missing", elt); } - if (l.length == 0) { // this list will be empty if there is no link + if (l === null || l.length == 0) { report("banner.gif link is missing", elt); } } @@ -57,7 +57,13 @@ , 'severity': 1 , 'rule': function() { - var norm = function (s) { return /^\w+\s+\w+/.exec(s)[0]; } // select out first two words of the input + // select out first two words of the input + var norm = function (s) { + if (/^\w+\s+\w+/.exec(s)) + return /^\w+\s+\w+/.exec(s)[0]; + else + return "null null"; + }; var imgs = $5("img").not("div.filmstrip *"); // select images not in the filmstrip imgs.cssIsNot("border", "1px solid", norm) .each(function (i, elt) { |