-
-
Notifications
You must be signed in to change notification settings - Fork 311
Explicitly ignore containers within navbar for E004 #255
base: master
Are you sure you want to change the base?
Conversation
src/bootlint.js
Outdated
@@ -409,7 +409,9 @@ var LocationIndex = _location.LocationIndex; | |||
} | |||
}); | |||
addLinter("E004", function lintNestedContainers($, reporter) { | |||
var nestedContainers = $('.container, .container-fluid').children('.container, .container-fluid'); | |||
var nestedContainers = $('.container, .container-fluid').filter(function(i, div) { | |||
return $(this).find('.navbar').length === 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation is off here. Use 4 spaces per indentation please. This should begin at column 12.
Argh. Had my editor set for work indentation. Will fix when I get home. |
src/bootlint.js
Outdated
@@ -409,7 +409,9 @@ var LocationIndex = _location.LocationIndex; | |||
} | |||
}); | |||
addLinter("E004", function lintNestedContainers($, reporter) { | |||
var nestedContainers = $('.container, .container-fluid').children('.container, .container-fluid'); | |||
var nestedContainers = $('.container, .container-fluid').filter(function () { | |||
return $(this).find('.navbar').length === 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be simplified to .not(':has(.navbar)')
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this time I'd been fighting cheerio with a .find(':not(.navbar)')
check. I'll make the change.
@@ -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'); |
There was a problem hiding this comment.
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>
Fix #215
.navbar