var createMapFromString = utils.createMapFromString;
// non-empty tags that will maintain whitespace around them
-var inlineTags = createMapFromString('a,abbr,acronym,b,bdi,bdo,big,button,cite,code,del,dfn,em,font,i,ins,kbd,mark,math,nobr,q,rt,rp,s,samp,small,span,strike,strong,sub,sup,svg,time,tt,u,var');
+var inlineTags = createMapFromString('a,abbr,acronym,b,bdi,bdo,big,button,cite,code,del,dfn,em,font,i,ins,kbd,label,mark,math,nobr,object,q,rt,rp,s,samp,select,small,span,strike,strong,sub,sup,svg,textarea,time,tt,u,var');
// non-empty tags that will maintain whitespace within them
var inlineTextTags = createMapFromString('a,abbr,acronym,b,big,del,em,font,i,ins,kbd,mark,nobr,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var');
// self-closing tags that will maintain whitespace around them
if (!stackNoTrimWhitespace.length) {
squashTrailingWhitespace(tag);
}
- if (!_canTrimWhitespace(tag, attrs) || stackNoTrimWhitespace.length) {
- stackNoTrimWhitespace.push(tag);
- }
- if (!_canCollapseWhitespace(tag, attrs) || stackNoCollapseWhitespace.length) {
- stackNoCollapseWhitespace.push(tag);
+ if (!unary) {
+ if (!_canTrimWhitespace(tag, attrs) || stackNoTrimWhitespace.length) {
+ stackNoTrimWhitespace.push(tag);
+ }
+ if (!_canCollapseWhitespace(tag, attrs) || stackNoCollapseWhitespace.length) {
+ stackNoCollapseWhitespace.push(tag);
+ }
}
}
input = '<p> foo\u00A0bar\nbaz \u00A0\nmoo\t</p>';
output = '<p>foo\u00A0bar baz \u00A0 moo</p>';
assert.equal(minify(input, { collapseWhitespace: true }), output);
+ input = '<label> foo </label>\n' +
+ '<input>\n' +
+ '<object> bar </object>\n' +
+ '<select> baz </select>\n' +
+ '<textarea> moo </textarea>\n';
+ output = '<label>foo</label> <input> <object>bar</object> <select>baz</select> <textarea> moo </textarea>';
+ assert.equal(minify(input, { collapseWhitespace: true }), output);
+ input = '<pre>\n' +
+ 'foo\n' +
+ '<br>\n' +
+ 'bar\n' +
+ '</pre>\n' +
+ 'baz\n';
+ output = '<pre>\nfoo\n<br>\nbar\n</pre>baz';
+ assert.equal(minify(input, { collapseWhitespace: true }), output);
});
QUnit.test('types of whitespace that should always be preserved', function(assert) {
'<textarea disabled="disabled"> this is a textarea </textarea>' +
'</div></div></div></div></div></div>' +
'<pre> \r\nxxxx</pre><span>x</span> <span>Hello</span> <b>billy</b> ' +
- '<input type="text"><textarea></textarea><pre></pre>';
+ '<input type="text"> <textarea></textarea><pre></pre>';
assert.equal(minify(input, { collapseWhitespace: true }), output);
input = '<pre title="some title..."> hello world </pre>';
'<form (ngSubmit)=onSubmit(theForm) #theForm=ngForm>' +
'<div class=form-group>' +
'<label for=name>Name</label>' +
- '<input class=form-control required ngControl=firstName [(ngModel)]=currentHero.firstName>' +
+ ' <input class=form-control required ngControl=firstName [(ngModel)]=currentHero.firstName>' +
'</div>' +
'<button type=submit [disabled]=!theForm.form.valid>Submit</button>' +
'</form>';