Skip to content

Remove trailing whitespace in inlined templates #1596

@iuliust

Description

@iuliust

Bug, feature request, or proposal:

Bug

What is the expected behavior?

The string representing a component's template should not have a whitespace as the last character.

What is the current behavior?

Every material component's template appends a whitespace at the end of the string in the JS transpiled file.

What are the steps to reproduce?

<button md-button class="increment" (click)="increment()">A+</button>

will be translated into :

<button class="increment" md-button=""><span class="md-button-wrapper">A+</span> </button>

... see the whitespace just before </button> ?
It will be appended before the closing tag of any material element whose template file has a new line before the EndOfFile...

What is the use-case or motivation for changing an existing behavior?

the following test should work :

it('should display a button that reads "A+" ', () => {
        const buttonContent = button.textContent;
        expect(buttonContent).toEqual('A+');
    });

Which versions of Angular, Material, OS, browsers are affected?

Any version that follows the official style guide's linting recommendations.

Is there anything else we should know?

You're awesome !

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgenthelp wantedThe team would appreciate a PR from the community to address this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions