Skip to content

Remove trailing whitespace in inlined templates #1596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
iuliust opened this issue Oct 25, 2016 · 1 comment · Fixed by #4877
Closed

Remove trailing whitespace in inlined templates #1596

iuliust opened this issue Oct 25, 2016 · 1 comment · Fixed by #4877
Assignees
Labels
help wanted The team would appreciate a PR from the community to address this issue P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent

Comments

@iuliust
Copy link

iuliust commented Oct 25, 2016

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 !

@jelbourn jelbourn added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Oct 25, 2016
@jelbourn jelbourn added the help wanted The team would appreciate a PR from the community to address this issue label Apr 9, 2017
@jelbourn jelbourn changed the title Every material Component append a whitespace as the last character of their template Remove trailing whitespace in inlined templates Apr 9, 2017
@devversion devversion self-assigned this May 30, 2017
devversion added a commit to devversion/material2 that referenced this issue May 30, 2017
* Now minifies the HTML files before inlining the resources. This drops unnecessary whitespace due to previous line breaks and developers can easily test with Material components.

Fixes angular#1596
devversion added a commit to devversion/material2 that referenced this issue May 30, 2017
* Now minifies the HTML files before inlining the resources. This drops unnecessary whitespace due to previous line breaks and developers can easily test with Material components.

Fixes angular#1596
mmalerba pushed a commit that referenced this issue May 30, 2017
* build: minify html before inlining resources

* Now minifies the HTML files before inlining the resources. This drops unnecessary whitespace due to previous line breaks and developers can easily test with Material components.

Fixes #1596

* Address comment
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted The team would appreciate a PR from the community to address this issue P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
4 participants