Skip to content

Commit

Permalink
use lower case in useShortDoctype (#944)
Browse files Browse the repository at this point in the history
fixes #822
  • Loading branch information
alexlamsl authored Jul 8, 2018
1 parent f9c6ed9 commit 57bebd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/htmlminifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ function minify(value, options, partialMarkup) {
buffer.push(text);
},
doctype: function(doctype) {
buffer.push(options.useShortDoctype ? '<!DOCTYPE html>' : collapseWhitespaceAll(doctype));
buffer.push(options.useShortDoctype ? '<!doctype html>' : collapseWhitespaceAll(doctype));
},
customAttrAssign: options.customAttrAssign,
customAttrSurround: options.customAttrSurround
Expand Down
9 changes: 5 additions & 4 deletions tests/minifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<!doctype html>';

input = '<!DOCTYPE html>';
assert.equal(minify(input, { useShortDoctype: false }), input);
assert.equal(minify(input, { useShortDoctype: true }), input);
assert.equal(minify(input, { useShortDoctype: true }), output);

input = '<!DOCTYPE\nhtml>';
assert.equal(minify(input, { useShortDoctype: false }), '<!DOCTYPE html>');
assert.equal(minify(input, { useShortDoctype: true }), '<!DOCTYPE html>');
assert.equal(minify(input, { useShortDoctype: true }), output);

input = '<!DOCTYPE\thtml>';
assert.equal(minify(input, { useShortDoctype: false }), input);
assert.equal(minify(input, { useShortDoctype: true }), '<!DOCTYPE html>');
assert.equal(minify(input, { useShortDoctype: true }), output);

input = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\n "http://www.w3.org/TR/html4/strict.dtd">';
assert.equal(minify(input, { useShortDoctype: false }), '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">');
assert.equal(minify(input, { useShortDoctype: true }), '<!DOCTYPE html>');
assert.equal(minify(input, { useShortDoctype: true }), output);
});

QUnit.test('removing comments', function(assert) {
Expand Down

0 comments on commit 57bebd5

Please sign in to comment.