MCPcopy Create free account
hub / github.com/angular/angular / toHtml

Function toHtml

packages/core/test/render3/view_fixture.ts:247–268  ·  view source on GitHub ↗
(element: Element, keepNgReflect = false)

Source from the content-addressed store, hash-verified

245}
246
247function toHtml(element: Element, keepNgReflect = false): string {
248 if (element) {
249 let html = stringifyElement(element);
250
251 if (!keepNgReflect) {
252 html = html
253 .replace(/\sng-reflect-\S*="[^"]*"/g, '')
254 .replace(/<!--bindings=\{(\W.*\W\s*)?\}-->/g, '');
255 }
256
257 html = html
258 .replace(/^<div host="">(.*)<\/div>$/, '$1')
259 .replace(/^<div fixture="mark">(.*)<\/div>$/, '$1')
260 .replace(/^<div host="mark">(.*)<\/div>$/, '$1')
261 .replace(' style=""', '')
262 .replace(/<!--container-->/g, '')
263 .replace(/<!--ng-container-->/g, '');
264 return html;
265 } else {
266 return '';
267 }
268}

Callers 1

htmlMethod · 0.70

Calls 2

stringifyElementFunction · 0.90
replaceMethod · 0.45

Tested by

no test coverage detected