From f8c1e9269a0b92379523004d5a175682007e4e23 Mon Sep 17 00:00:00 2001 From: Zac Echola Date: Mon, 2 Mar 2015 12:33:07 -0600 Subject: [PATCH 1/3] Fix #215 1. Ignore containers within `.navbar` 2. Expand search for more than just direct children. --- src/bootlint.js | 4 +++- test/fixtures/containers/nested-fixed-fluid.html | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bootlint.js b/src/bootlint.js index 40021bd8..bdb713a6 100644 --- a/src/bootlint.js +++ b/src/bootlint.js @@ -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; + }).find('.container, .container-fluid'); if (nestedContainers.length) { reporter("Containers (`.container` and `.container-fluid`) are not nestable", nestedContainers); } diff --git a/test/fixtures/containers/nested-fixed-fluid.html b/test/fixtures/containers/nested-fixed-fluid.html index 9e8acd19..e401cfb3 100644 --- a/test/fixtures/containers/nested-fixed-fluid.html +++ b/test/fixtures/containers/nested-fixed-fluid.html @@ -21,6 +21,12 @@
+
+ +
+
  1. From 6e7f5188c1d628853fc85eded79d3ce7b28976e8 Mon Sep 17 00:00:00 2001 From: Zac Echola Date: Mon, 2 Mar 2015 17:07:00 -0600 Subject: [PATCH 2/3] retabbing, style fixes. --- src/bootlint.js | 4 ++-- test/fixtures/containers/nested-fixed-fluid.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bootlint.js b/src/bootlint.js index bdb713a6..20ccae9c 100644 --- a/src/bootlint.js +++ b/src/bootlint.js @@ -409,8 +409,8 @@ var LocationIndex = _location.LocationIndex; } }); addLinter("E004", function lintNestedContainers($, reporter) { - var nestedContainers = $('.container, .container-fluid').filter(function(i, div) { - return $(this).find('.navbar').length === 0; + var nestedContainers = $('.container, .container-fluid').filter(function () { + return $(this).find('.navbar').length === 0; }).find('.container, .container-fluid'); if (nestedContainers.length) { reporter("Containers (`.container` and `.container-fluid`) are not nestable", nestedContainers); diff --git a/test/fixtures/containers/nested-fixed-fluid.html b/test/fixtures/containers/nested-fixed-fluid.html index e401cfb3..2e59a8e9 100644 --- a/test/fixtures/containers/nested-fixed-fluid.html +++ b/test/fixtures/containers/nested-fixed-fluid.html @@ -22,9 +22,9 @@
    - +
    From 6eb502e52fb9b27ab8ddd57849dd74848a79c229 Mon Sep 17 00:00:00 2001 From: Zac Echola Date: Tue, 3 Mar 2015 08:08:02 -0600 Subject: [PATCH 3/3] simplify selector --- src/bootlint.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/bootlint.js b/src/bootlint.js index 20ccae9c..06c9196b 100644 --- a/src/bootlint.js +++ b/src/bootlint.js @@ -409,9 +409,7 @@ var LocationIndex = _location.LocationIndex; } }); addLinter("E004", function lintNestedContainers($, reporter) { - var nestedContainers = $('.container, .container-fluid').filter(function () { - return $(this).find('.navbar').length === 0; - }).find('.container, .container-fluid'); + var nestedContainers = $('.container, .container-fluid').not(':has(.navbar)').find('.container, .container-fluid'); if (nestedContainers.length) { reporter("Containers (`.container` and `.container-fluid`) are not nestable", nestedContainers); }