fix(upgrade): fix transclusion on upgraded components (#17971)

Previously, only simple, single-slot transclusion worked on upgraded components.
This commit fixes/adds support for the following:

- Multi-slot transclusion.
- Using fallback content when no transclusion content is provided.
- Destroy unused scope (when using fallback content).

Fixes #13271
This commit is contained in:
Georgios Kalpakas
2017-07-05 13:58:27 +03:00
committed by Jason Aden
parent 227dbbcfba
commit 67e9c62013
5 changed files with 547 additions and 10 deletions

View File

@ -20,9 +20,10 @@ export function html(html: string): Element {
return div;
}
export function multiTrim(text: string | null | undefined): string {
export function multiTrim(text: string | null | undefined, allSpace = false): string {
if (typeof text == 'string') {
return text.replace(/\n/g, '').replace(/\s\s+/g, ' ').trim();
const repl = allSpace ? '' : ' ';
return text.replace(/\n/g, '').replace(/\s+/g, repl).trim();
}
throw new Error('Argument can not be undefined.');
}