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

Explicitly ignore containers within navbar for E004 #255

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootlint.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ var LocationIndex = _location.LocationIndex;
}
});
addLinter("E004", function lintNestedContainers($, reporter) {
var nestedContainers = $('.container, .container-fluid').children('.container, .container-fluid');
var nestedContainers = $('.container, .container-fluid').not(':has(.navbar)').find('.container, .container-fluid');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic seems wrong. Consider:

<div class="container">
  <div class="navbar"></div>
  <div class="container"></div>
</div>

if (nestedContainers.length) {
reporter("Containers (`.container` and `.container-fluid`) are not nestable", nestedContainers);
}
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/containers/nested-fixed-fluid.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
<div class="container-fluid"></div>
</div>

<div class="container">
<div class="navbar">
<div class="container-fluid"></div>
</div>
</div>

<div id="qunit"></div>
<ol id="bootlint">
<li data-lint="Containers (`.container` and `.container-fluid`) are not nestable"></li>
Expand Down