Repository: twbs/bootlint (js)

Issue:
[Modal] .row after .modal-body Causing error
Hello, on documentation [here](http://getbootstrap.com/javascript/#modals-grid-system) the `.row` can be nested after `.modal-body`, but bootlint on my Atom editor says: E003 Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid`

Its a issue? Thanks!


Pull request description:
Allow `.row` in `.modal-body`.
Fixes #390.

Patch:
diff --git a/src/bootlint.js b/src/bootlint.js
index b724b04..5194f76 100644
--- a/src/bootlint.js
+++ b/src/bootlint.js
@@ -642,7 +642,7 @@ var LocationIndex = _location.LocationIndex;
         var rowsOutsideColumnsAndContainers = rowsOutsideColumns.filter(function () {
             var parent = $(this).parent();
             while (parent.length) {
-                if (parent.is('.container, .container-fluid')) {
+                if (parent.is('.container, .container-fluid, .modal-body')) {
                     return false;
                 }
                 parent = $(parent).parent();
@@ -650,7 +650,7 @@ var LocationIndex = _location.LocationIndex;
             return true;
         });
         if (rowsOutsideColumnsAndContainers.length) {
-            reporter('Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid`', rowsOutsideColumnsAndContainers);
+            reporter('Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid` or `.modal-body`', rowsOutsideColumnsAndContainers);
         }
     });
     addLinter('E004', function lintNestedContainers($, reporter) {


Test patch:
diff --git a/test/bootlint_test.js b/test/bootlint_test.js
index 269f9fc..15161c8 100644
--- a/test/bootlint_test.js
+++ b/test/bootlint_test.js
@@ -103,7 +103,7 @@ exports.bootlint = {
         test.done();
     },
     'rows outside containers': function (test) {
-        test.expect(5);
+        test.expect(6);
         test.deepEqual(lintHtml(utf8Fixture('containers/fixed.html')),
             [],
             'should not complain when rows are descendants of fixed containers.');
@@ -114,11 +114,14 @@ exports.bootlint = {
             [],
             'should not complain when rows are children of columns.');
         test.deepEqual(lintHtml(utf8Fixture('containers/missing.html')),
-            ['Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid`'],
+            ['Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid` or `.modal-body`'],
             'should complain when a row is not a descendant of a container.');
         test.deepEqual(lintHtml(utf8Fixture('containers/ancestor.html')),
             [],
             'should not complain when rows are descendants (but not children) of containers.');
+        test.deepEqual(lintHtml(utf8Fixture('containers/row-inside-modal-body.html')),
+            [],
+            'should not complain when rows are children of `.modal-body`.');
         test.done();
     },
     'nested containers': function (test) {
@@ -160,10 +163,10 @@ exports.bootlint = {
     'row and container classes on same element': function (test) {
         test.expect(2);
         test.deepEqual(lintHtml(utf8Fixture('containers/fixed-row-same-elem.html')),
-            ['Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid`'],
+            ['Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid` or `.modal-body`'],
             'should complain when .row and .container are used on the same element.');
         test.deepEqual(lintHtml(utf8Fixture('containers/fluid-row-same-elem.html')),
-            ['Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid`'],
+            ['Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid` or `.modal-body`'],
             'should complain when .row and .container-fluid are used on the same element.');
         test.done();
     },
diff --git a/test/fixtures/containers/fixed-row-same-elem.html b/test/fixtures/containers/fixed-row-same-elem.html
index e4c8305..cfaf4a1 100644
--- a/test/fixtures/containers/fixed-row-same-elem.html
+++ b/test/fixtures/containers/fixed-row-same-elem.html
@@ -21,7 +21,7 @@
 
         <div id="qunit"></div>
         <ol id="bootlint">
-            <li data-lint="Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid`"></li>
+            <li data-lint="Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid` or `.modal-body`"></li>
         </ol>
     </body>
 </html>
diff --git a/test/fixtures/containers/fluid-row-same-elem.html b/test/fixtures/containers/fluid-row-same-elem.html
index e4eb472..960ceaf 100644
--- a/test/fixtures/containers/fluid-row-same-elem.html
+++ b/test/fixtures/containers/fluid-row-same-elem.html
@@ -21,7 +21,7 @@
 
         <div id="qunit"></div>
         <ol id="bootlint">
-            <li data-lint="Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid`"></li>
+            <li data-lint="Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid` or `.modal-body`"></li>
         </ol>
     </body>
 </html>
diff --git a/test/fixtures/containers/missing.html b/test/fixtures/containers/missing.html
index e1a800a..f48b6c0 100644
--- a/test/fixtures/containers/missing.html
+++ b/test/fixtures/containers/missing.html
@@ -21,7 +21,7 @@
 
         <div id="qunit"></div>
         <ol id="bootlint">
-            <li data-lint="Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid`"></li>
+            <li data-lint="Found one or more `.row`s that were not children of a grid column or descendants of a `.container` or `.container-fluid` or `.modal-body`"></li>
         </ol>
     </body>
 </html>
diff --git a/test/fixtures/containers/row-inside-modal-body.html b/test/fixtures/containers/row-inside-modal-body.html
new file mode 100644
index 0000000..5b99610
--- /dev/null
+++ b/test/fixtures/containers/row-inside-modal-body.html
@@ -0,0 +1,35 @@
+<!doctype html>
+<html lang="en">
+    <head>
+        <meta charset="utf-8">
+        <meta http-equiv="X-UA-Compatible" content="IE=edge">
+        <meta name="viewport" content="width=device-width, initial-scale=1">
+        <title>Test</title>
+        <link rel="stylesheet" href="../../../node_modules/qunit/qunit/qunit.css">
+
+        <!--[if lt IE 9]>
+            <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
+            <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
+        <![endif]-->
+        <script src="../../../node_modules/jquery/dist/jquery.min.js"></script>
+        <script src="../../../node_modules/qunit/qunit/qunit.js"></script>
+        <script src="../../../dist/browser/bootlint.js"></script>
+        <script src="../generic-qunit.js"></script>
+    </head>
+    <body>
+        <div class="modal" tabindex="-1" role="dialog">
+            <div class="modal-dialog" role="document">
+                <div class="modal-content">
+                    <div class="modal-body">
+                        <div class="row">
+                            <div class="col-sm-4">Content</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+
+        <div id="qunit"></div>
+        <ol id="bootlint"></ol>
+    </body>
+</html>