diff --git a/src/rules/alt-not-empty.js b/src/rules/alt-not-empty.js index bd435494f..48af4f873 100644 --- a/src/rules/alt-not-empty.js +++ b/src/rules/alt-not-empty.js @@ -24,11 +24,11 @@ HTMLHint.addRule({ } if ((tagName === 'area' && 'href' in attrMap) || (tagName === 'input' && attrMap['type'] === 'image')) { - selector = tagName === 'area' ? 'area[href]' : 'input[type=image]'; if (!('alt' in attrMap) || attrMap['alt'] === '') { + selector = tagName === 'area' ? 'area[href]' : 'input[type=image]'; reporter.warn('Alt of ' + selector + ' must be set value.', event.line, col, self, event.raw); } } }); } -}); \ No newline at end of file +}); diff --git a/test/rules/alt-not-empty.js b/test/rules/alt-not-empty.js index e3173580d..2ce6c6bb4 100644 --- a/test/rules/alt-not-empty.js +++ b/test/rules/alt-not-empty.js @@ -91,4 +91,4 @@ describe('Rules: '+ruldId, function(){ var messages = HTMLHint.verify(code, ruleOptions); expect(messages.length).to.be(0); }); -}); \ No newline at end of file +});