From c4216458f7c47a9bb58e8486873976e245892366 Mon Sep 17 00:00:00 2001 From: Kevin Kirsche Date: Sat, 28 Feb 2015 18:10:06 -0500 Subject: [PATCH] [Fixes #249] Use parse5 for standard-compliant parsing [Fixes #249] Use parse5 for standard-compliant parsing --- dist/browser/bootlint.js | 37 ++++++++++++++++++++++++++++++++----- package.json | 4 ++-- src/bootlint.js | 2 +- test/bootlint_test.js | 2 +- 4 files changed, 36 insertions(+), 9 deletions(-) diff --git a/dist/browser/bootlint.js b/dist/browser/bootlint.js index 54eb2feb..dbe867e1 100644 --- a/dist/browser/bootlint.js +++ b/dist/browser/bootlint.js @@ -10379,6 +10379,31 @@ if (typeof define === 'function' && define.amd) ); },{}],4:[function(require,module,exports){ +/** + * This file automatically generated from `pre-publish.js`. + * Do not manually edit. + */ + +module.exports = { + "area": true, + "base": true, + "br": true, + "col": true, + "embed": true, + "hr": true, + "img": true, + "input": true, + "keygen": true, + "link": true, + "menuitem": true, + "meta": true, + "param": true, + "source": true, + "track": true, + "wbr": true +}; + +},{}],5:[function(require,module,exports){ /*! * Bootlint - an HTML linter for Bootstrap projects * https://github.com/twbs/bootlint @@ -10388,9 +10413,10 @@ if (typeof define === 'function' && define.amd) /*eslint-env node */ -var cheerio = require('cheerio'); +var cheerio = require('whacko'); var parseUrl = require('url').parse; var semver = require('semver'); +var voidElements = require('void-elements'); var _location = require('./location'); var LocationIndex = _location.LocationIndex; @@ -11209,15 +11235,16 @@ var LocationIndex = _location.LocationIndex; }); addLinter("W009", function lintEmptySpacerCols($, reporter) { var selector = COL_CLASSES.map(function (colClass) { - return colClass + ':not(col):not(:last-child)'; + return colClass + ':not(:last-child)'; }).join(','); var columns = $(selector); columns.each(function (_index, col) { var column = $(col); + var isVoidElement = voidElements[col.tagName.toLowerCase()]; // can't just use :empty because :empty excludes nodes with all-whitespace text content var hasText = !!column.text().trim().length; var hasChildren = !!column.children(':first-child').length; - if (hasChildren || hasText) { + if (hasChildren || hasText || isVoidElement) { return; } @@ -11458,7 +11485,7 @@ var LocationIndex = _location.LocationIndex; } })(typeof exports === 'object' && exports || this); -},{"./location":1,"cheerio":2,"semver":3,"url":5}],5:[function(require,module,exports){ +},{"./location":1,"semver":3,"url":6,"void-elements":4,"whacko":2}],6:[function(require,module,exports){ /*eslint-env node, browser */ /* jshint browser: true */ /** @@ -11498,4 +11525,4 @@ var LocationIndex = _location.LocationIndex; exports.parse = parse; })(); -},{}]},{},[4]); +},{}]},{},[5]); diff --git a/package.json b/package.json index 09af8eb2..1527a5c8 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "bluebird": "^2.9.12", "body-parser": "^1.12.0", "chalk": "^1.0.0", - "cheerio": "^0.18.0", + "whacko": "^0.17.4", "commander": "^2.6.0", "debug": "^2.1.1", "express": "^4.11.2", @@ -73,7 +73,7 @@ }, "browser": { "binary-search": false, - "cheerio": "jquery", + "whacko": "jquery", "url": "./src/url.js", "./cli": false, "./location": false diff --git a/src/bootlint.js b/src/bootlint.js index a947d58e..d076d0d8 100644 --- a/src/bootlint.js +++ b/src/bootlint.js @@ -7,7 +7,7 @@ /*eslint-env node */ -var cheerio = require('cheerio'); +var cheerio = require('whacko'); var parseUrl = require('url').parse; var semver = require('semver'); var voidElements = require('void-elements'); diff --git a/test/bootlint_test.js b/test/bootlint_test.js index b2655862..c70e5104 100644 --- a/test/bootlint_test.js +++ b/test/bootlint_test.js @@ -59,7 +59,7 @@ exports.bootlint = { [], 'should not complain when the normal simple HTML5 doctype is used.'); test.deepEqual(lintHtml(utf8Fixture('doctype/html5-legacy.html')), - [], + ['Document declares a non-HTML5 DOCTYPE'], 'should not complain when the legacy-compatibility HTML5 doctype is used.'); test.done(); },