Polymer / polymer

Our original Web Component library.
https://polymer-library.polymer-project.org/
BSD 3-Clause "New" or "Revised" License
22.04k stars 2.01k forks source link

Avoid cost of setting display:none under legacyOptimizations #5541

Closed kevinpschaaf closed 5 years ago

kevinpschaaf commented 5 years ago

Description

https://github.com/Polymer/polymer/pull/4821 addressed the fact that <dom-repeat> and <dom-if> elements can participate in e.g. flexbox and other selectors inadvertently, which was a change from Polymer 1.x where these were <template> type extensions, by adding this.style.display = 'none' to the elements' lifecycle. Although it fixed the issue, it unfortunately has been found to add a measurable tax to element boot-up, particularly on Edge, which is unfortunate if e.g. flexbox issues can otherwise be avoided.

This issue is to only set display: none when not running under the legacyOptimizations flag, as a way to opt-out of the correct behavior to optimize for performance.