Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Commit 0d2b0f5

Browse files
committed
Adapt to button changes
Remove E016, and E021 Port W007, W016, and E047
1 parent 4ec113f commit 0d2b0f5

14 files changed

+2
-298
lines changed

src/bootlint.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -442,14 +442,12 @@ var LocationIndex = _location.LocationIndex;
442442
}
443443
});
444444
*/
445-
/*
446445
addLinter('W007', function lintBtnType($, reporter) {
447446
var badBtnType = $('button:not([type="submit"], [type="reset"], [type="button"])');
448447
if (badBtnType.length) {
449448
reporter('Found one or more `<button>`s missing a `type` attribute.', badBtnType);
450449
}
451450
});
452-
*/
453451
/*
454452
addLinter('W008', function lintTooltipsInBtnGroups($, reporter) {
455453
var nonBodyContainers = $('.btn-group [data-toggle="tooltip"]:not([data-container="body"]), .btn-group [data-toggle="popover"]:not([data-container="body"])');
@@ -536,22 +534,18 @@ var LocationIndex = _location.LocationIndex;
536534
});
537535
});
538536
*/
539-
/*
540537
addLinter('W016', function lintDisabledClassOnButton($, reporter) {
541538
var btnsWithDisabledClass = $('button.btn.disabled, input.btn.disabled');
542539
if (btnsWithDisabledClass.length) {
543540
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);
544541
}
545542
});
546-
*/
547-
/*
548543
addLinter('W017', function lintInputsMissingTypeAttr($, reporter) {
549544
var inputsMissingTypeAttr = $('input:not([type])');
550545
if (inputsMissingTypeAttr.length) {
551546
reporter('Found one or more `<input>`s missing a `type` attribute.', inputsMissingTypeAttr);
552547
}
553548
});
554-
*/
555549
addLinter('E001', (function () {
556550
var MISSING_DOCTYPE = 'Document is missing a DOCTYPE declaration';
557551
var NON_HTML5_DOCTYPE = 'Document declares a non-HTML5 DOCTYPE';
@@ -717,14 +711,6 @@ var LocationIndex = _location.LocationIndex;
717711
});
718712
*/
719713
/*
720-
addLinter('E016', function lintBtnToggle($, reporter) {
721-
var badBtnToggle = $('.btn.dropdown-toggle ~ .btn');
722-
if (badBtnToggle.length) {
723-
reporter('`.btn.dropdown-toggle` must be the last button in a button group.', badBtnToggle);
724-
}
725-
});
726-
*/
727-
/*
728714
addLinter('E017', function lintBlockCheckboxes($, reporter) {
729715
var badCheckboxes = $('.checkbox').filter(function (i, div) {
730716
return $(div).filter(':has(>label>input[type="checkbox"])').length <= 0;
@@ -772,20 +758,6 @@ var LocationIndex = _location.LocationIndex;
772758
}
773759
});
774760
*/
775-
/*
776-
addLinter('E021', function lintButtonsCheckedActive($, reporter) {
777-
var selector = [
778-
'[data-toggle="buttons"]>label:not(.active)>input[type="checkbox"][checked]',
779-
'[data-toggle="buttons"]>label.active>input[type="checkbox"]:not([checked])',
780-
'[data-toggle="buttons"]>label:not(.active)>input[type="radio"][checked]',
781-
'[data-toggle="buttons"]>label.active>input[type="radio"]:not([checked])'
782-
].join(',');
783-
var mismatchedButtonInputs = $(selector);
784-
if (mismatchedButtonInputs.length) {
785-
reporter('`.active` class used without the `checked` attribute (or vice-versa) in a button group using the button.js plugin', mismatchedButtonInputs);
786-
}
787-
});
788-
*/
789761
addLinter('E022', function lintModalsWithinOtherComponents($, reporter) {
790762
var selector = [
791763
'.table .modal',
@@ -1052,14 +1024,12 @@ var LocationIndex = _location.LocationIndex;
10521024
reporter('`.modal` elements must have a `tabindex` attribute.', modalsWithoutTabindex);
10531025
}
10541026
});
1055-
/*
10561027
addLinter('E047', function lintBtnElements($, reporter) {
10571028
var btns = $('.btn:not(a,button,input,label)');
10581029
if (btns.length) {
10591030
reporter('`.btn` should only be used on `<a>`, `<button>`, `<input>`, or `<label>` elements.', btns);
10601031
}
10611032
});
1062-
*/
10631033
addLinter('E048', function lintModalRole($, reporter) {
10641034
var modals = $('.modal:not([role="dialog"])');
10651035
if (modals.length) {

test/_old_fixtures/buttons-plugin/checkbox-bad.html

Lines changed: 0 additions & 37 deletions
This file was deleted.

test/_old_fixtures/buttons-plugin/radio-bad.html

Lines changed: 0 additions & 37 deletions
This file was deleted.

test/_old_fixtures/buttons-plugin/valid.html

Lines changed: 0 additions & 47 deletions
This file was deleted.

test/_old_fixtures/buttons/btn-toggle-after-btn.html

Lines changed: 0 additions & 41 deletions
This file was deleted.

test/_old_fixtures/buttons/btn-toggle.html

Lines changed: 0 additions & 71 deletions
This file was deleted.

0 commit comments

Comments
 (0)