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

Commit 3429120

Browse files
committed
Adapt to button changes
Remove E016, and E021 Port W007, W016, and E047
1 parent c499d3a commit 3429120

14 files changed

+2
-298
lines changed

src/bootlint.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,12 @@ var LocationIndex = _location.LocationIndex;
440440
}
441441
});
442442
*/
443-
/*
444443
addLinter('W007', function lintBtnType($, reporter) {
445444
var badBtnType = $('button:not([type="submit"], [type="reset"], [type="button"])');
446445
if (badBtnType.length) {
447446
reporter('Found one or more `<button>`s missing a `type` attribute.', badBtnType);
448447
}
449448
});
450-
*/
451449
/*
452450
addLinter('W008', function lintTooltipsInBtnGroups($, reporter) {
453451
var nonBodyContainers = $('.btn-group [data-toggle="tooltip"]:not([data-container="body"]), .btn-group [data-toggle="popover"]:not([data-container="body"])');
@@ -532,22 +530,18 @@ var LocationIndex = _location.LocationIndex;
532530
}
533531
});
534532
});
535-
/*
536533
addLinter('W016', function lintDisabledClassOnButton($, reporter) {
537534
var btnsWithDisabledClass = $('button.btn.disabled, input.btn.disabled');
538535
if (btnsWithDisabledClass.length) {
539536
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);
540537
}
541538
});
542-
*/
543-
/*
544539
addLinter('W017', function lintInputsMissingTypeAttr($, reporter) {
545540
var inputsMissingTypeAttr = $('input:not([type])');
546541
if (inputsMissingTypeAttr.length) {
547542
reporter('Found one or more `<input>`s missing a `type` attribute.', inputsMissingTypeAttr);
548543
}
549544
});
550-
*/
551545
addLinter('E001', (function () {
552546
var MISSING_DOCTYPE = 'Document is missing a DOCTYPE declaration';
553547
var NON_HTML5_DOCTYPE = 'Document declares a non-HTML5 DOCTYPE';
@@ -713,14 +707,6 @@ var LocationIndex = _location.LocationIndex;
713707
});
714708
*/
715709
/*
716-
addLinter('E016', function lintBtnToggle($, reporter) {
717-
var badBtnToggle = $('.btn.dropdown-toggle ~ .btn');
718-
if (badBtnToggle.length) {
719-
reporter('`.btn.dropdown-toggle` must be the last button in a button group.', badBtnToggle);
720-
}
721-
});
722-
*/
723-
/*
724710
addLinter('E017', function lintBlockCheckboxes($, reporter) {
725711
var badCheckboxes = $('.checkbox').filter(function (i, div) {
726712
return $(div).filter(':has(>label>input[type="checkbox"])').length <= 0;
@@ -768,20 +754,6 @@ var LocationIndex = _location.LocationIndex;
768754
}
769755
});
770756
*/
771-
/*
772-
addLinter('E021', function lintButtonsCheckedActive($, reporter) {
773-
var selector = [
774-
'[data-toggle="buttons"]>label:not(.active)>input[type="checkbox"][checked]',
775-
'[data-toggle="buttons"]>label.active>input[type="checkbox"]:not([checked])',
776-
'[data-toggle="buttons"]>label:not(.active)>input[type="radio"][checked]',
777-
'[data-toggle="buttons"]>label.active>input[type="radio"]:not([checked])'
778-
].join(',');
779-
var mismatchedButtonInputs = $(selector);
780-
if (mismatchedButtonInputs.length) {
781-
reporter('`.active` class used without the `checked` attribute (or vice-versa) in a button group using the button.js plugin', mismatchedButtonInputs);
782-
}
783-
});
784-
*/
785757
addLinter('E022', function lintModalsWithinOtherComponents($, reporter) {
786758
var selector = [
787759
'.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)