Polymer: Feature request: support strip-whitespace when providing the template as a string

Created on 12 Jul 2017  路  6Comments  路  Source: Polymer/polymer

3.x enhancement p2 wontfix

Most helpful comment

Ping on this one, relevant to 3.x

All 6 comments

Ping on this one, relevant to 3.x

Hm, should be quite straightforward. The only thing we need to decide on is how to set the option.

From an optimization standpoint, this is going to bite our web application as we upgrade components. We can have thousands of components in the DOM at any given time, so those text nodes really add up.

So, I think this will work:

``javascript class MyElement extends PolymerElement { static get template() { const myTemplate = html

hello world

`;
myTemplate.setAttribute('strip-whitespace');
return myTemplate;
}
}

Yeah, tested it with https://glitch.com/edit/#!/wiry-pediatrician - the setAttribute trick works!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

augustoroman picture augustoroman  路  4Comments

SergRZ picture SergRZ  路  3Comments

nazar-pc picture nazar-pc  路  4Comments

limonte picture limonte  路  3Comments

masaoliou picture masaoliou  路  3Comments