Skip to content

Commit

Permalink
parse option element correctly (#869)
Browse files Browse the repository at this point in the history
fixes #866
  • Loading branch information
alexlamsl authored Nov 25, 2017
1 parent 94f9a49 commit 0f2a67f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/htmlparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ var inline = makeMap('a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,co

// Elements that you can, intentionally, leave open
// (and which close themselves)
var closeSelf = makeMap('colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source');
var closeSelf = makeMap('colgroup,dd,dt,li,option,p,td,tfoot,th,thead,tr,source');

// Attributes that have their values filled in disabled='disabled'
var fillAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected');
Expand Down
10 changes: 10 additions & 0 deletions tests/minifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -2996,6 +2996,16 @@ QUnit.test('auto-generated tags', function(assert) {
includeAutoGeneratedTags: false,
removeOptionalTags: true
}), output);

input = '<select><option>foo<option>bar</select>';
assert.equal(minify(input, { includeAutoGeneratedTags: false }), input);
output = '<select><option>foo</option><option>bar</option></select>';
assert.equal(minify(input, { includeAutoGeneratedTags: true }), output);

input = '<datalist><option label="A" value="1"><option label="B" value="2"></datalist>';
assert.equal(minify(input, { includeAutoGeneratedTags: false }), input);
output = '<datalist><option label="A" value="1"></option><option label="B" value="2"></option></datalist>';
assert.equal(minify(input, { includeAutoGeneratedTags: true }), output);
});

QUnit.test('sort attributes', function(assert) {
Expand Down

0 comments on commit 0f2a67f

Please sign in to comment.