From 5130943d66def581a8d6a084a2b5ffa2c3a1c8b1 Mon Sep 17 00:00:00 2001 From: Benjamin Jones Date: Wed, 19 Dec 2012 17:22:22 -0800 Subject: fixed rule errors that appear in firefox --- exampleData/ruleSets/colorRules.json | 2 +- exampleData/ruleSets/imageRules.json | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'exampleData') 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 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) { -- cgit v1.2.3