From 57bebd5d484b3ca25d9fd2e75fe7bc6b9773f0aa Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Mon, 9 Jul 2018 02:05:00 +0800 Subject: [PATCH] use lower case in `useShortDoctype` (#944) fixes #822 --- src/htmlminifier.js | 2 +- tests/minifier.js | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/htmlminifier.js b/src/htmlminifier.js index f21f8d38..22850320 100644 --- a/src/htmlminifier.js +++ b/src/htmlminifier.js @@ -1220,7 +1220,7 @@ function minify(value, options, partialMarkup) { buffer.push(text); }, doctype: function(doctype) { - buffer.push(options.useShortDoctype ? '' : collapseWhitespaceAll(doctype)); + buffer.push(options.useShortDoctype ? '' : collapseWhitespaceAll(doctype)); }, customAttrAssign: options.customAttrAssign, customAttrSurround: options.customAttrSurround diff --git a/tests/minifier.js b/tests/minifier.js index a3cf039c..bb59cdad 100644 --- a/tests/minifier.js +++ b/tests/minifier.js @@ -404,22 +404,23 @@ QUnit.test('types of whitespace that should always be preserved', function(asser QUnit.test('doctype normalization', function(assert) { var input; + var output = ''; input = ''; assert.equal(minify(input, { useShortDoctype: false }), input); - assert.equal(minify(input, { useShortDoctype: true }), input); + assert.equal(minify(input, { useShortDoctype: true }), output); input = ''; assert.equal(minify(input, { useShortDoctype: false }), ''); - assert.equal(minify(input, { useShortDoctype: true }), ''); + assert.equal(minify(input, { useShortDoctype: true }), output); input = ''; assert.equal(minify(input, { useShortDoctype: false }), input); - assert.equal(minify(input, { useShortDoctype: true }), ''); + assert.equal(minify(input, { useShortDoctype: true }), output); input = ''; assert.equal(minify(input, { useShortDoctype: false }), ''); - assert.equal(minify(input, { useShortDoctype: true }), ''); + assert.equal(minify(input, { useShortDoctype: true }), output); }); QUnit.test('removing comments', function(assert) {