diff options
author | Thomas Lindner <tclindner@gmail.com> | 2016-01-30 21:34:49 +0300 |
---|---|---|
committer | Chris Rebert <code@chrisrebert.com> | 2016-02-01 23:42:07 +0300 |
commit | 71a5c57866d94440de1054827285283d92c0b49a (patch) | |
tree | be6581bec2776fbdfee6ea55ef83fdcc3c208df0 /src | |
parent | 8c2ea747eeba0613a360d05bd10d30554f7aa73b (diff) |
Add W017 to check for <input>s without type attributes; fixes #341
Closes #350
* Add W017 to check for inputs that are missing a type attribute.
* Add new fixtures to test the new lint
* Update bootlint_test to call new fixtures
Diffstat (limited to 'src')
-rw-r--r-- | src/bootlint.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bootlint.js b/src/bootlint.js index e362c1f..e17bc39 100644 --- a/src/bootlint.js +++ b/src/bootlint.js @@ -578,6 +578,12 @@ var LocationIndex = _location.LocationIndex; reporter("Using the `.disabled` class on a `<button>` or `<input>` only changes the appearance of the element. It doesn't prevent the user from interacting with the element (for example, clicking on it or focusing it). If you want to truly disable the element, use the `disabled` attribute instead.", btnsWithDisabledClass); } }); + addLinter("W017", function lintInputsMissingTypeAttr($, reporter) { + var inputsMissingTypeAttr = $('input:not([type])'); + if (inputsMissingTypeAttr.length) { + reporter("Found one or more `<input>`s missing a `type` attribute.", inputsMissingTypeAttr); + } + }); addLinter("E001", (function () { var MISSING_DOCTYPE = "Document is missing a DOCTYPE declaration"; |