Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootlint.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Rebert <code@rebertia.com>2015-03-22 06:27:14 +0300
committerChris Rebert <code@rebertia.com>2015-03-23 22:37:29 +0300
commite0783e5de6575ea20086c30fc3202aa5f73431d0 (patch)
tree11e30ee74d8ad13780965d4fc7af46556a9ecc6c /src
parent3f5016a8a6cb84a0b43c07143fd535cc6068594f (diff)
Check for invalid uses of .form-control ; fixes #262
Diffstat (limited to 'src')
-rw-r--r--src/bootlint.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bootlint.js b/src/bootlint.js
index c342f98..70b43cf 100644
--- a/src/bootlint.js
+++ b/src/bootlint.js
@@ -905,6 +905,35 @@ var LocationIndex = _location.LocationIndex;
reporter('`.carousel-inner` must have exactly one `.item.active` child.', innersWithWrongActiveItems);
}
});
+ addLinter("E042", function lintFormControlOnWrongControl($, reporter) {
+ var formControlsOnWrongTags = $('.form-control:not(input,textarea,select)');
+ if (formControlsOnWrongTags.length) {
+ reporter('`.form-control` should only be used on `<input>`s, `<textarea>`s, and `<select>`s.', formControlsOnWrongTags);
+ }
+
+ var formControlsOnWrongTypes = $('input.form-control:not(' + ([
+ 'color',
+ 'email',
+ 'number',
+ 'password',
+ 'search',
+ 'tel',
+ 'text',
+ 'url',
+ 'datetime',
+ 'datetime-local',
+ 'date',
+ 'month',
+ 'week',
+ 'time'
+ ].map(function (type) {
+ return '[type="' + type + '"]';
+ }).join(',')
+ ) + ')');
+ if (formControlsOnWrongTypes.length) {
+ reporter('`.form-control` cannot be used on non-textual `<input>`s, such as those whose `type` is: `file`, `checkbox`, `radio`, `range`, `button`', formControlsOnWrongTypes);
+ }
+ });
addLinter("W009", function lintEmptySpacerCols($, reporter) {
var selector = COL_CLASSES.map(function (colClass) {
return colClass + ':not(:last-child)';