src/parse/state/mustache.js/trimWhitespace
function trimWhitespace ( block, trimBefore, trimAfter ) {
	const firstChild = block.children[0];
	const lastChild = block.children[ block.children.length - 1 ];

	if ( firstChild.type === 'Text' && trimBefore ) {
		firstChild.data = trimStart( firstChild.data );
		if ( !firstChild.data ) block.children.shift();
	}

	if ( lastChild.type === 'Text' && trimAfter ) {
		lastChild.data = trimEnd( lastChild.data );
		if ( !lastChild.data ) block.children.pop();
	}

	if ( block.else ) {
		trimWhitespace( block.else, trimBefore, trimAfter );
	}

	if ( firstChild.elseif ) {
		trimWhitespace( firstChild, trimBefore, trimAfter );
	}
}