MCPcopy
hub / github.com/angular/angular / stripUtilAttributes

Function stripUtilAttributes

packages/platform-server/test/dom_utils.ts:43–57  ·  view source on GitHub ↗
(html: string, keepNgh: boolean)

Source from the content-addressed store, hash-verified

41 * so that it's easier to make assertions in tests.
42 */
43export function stripUtilAttributes(html: string, keepNgh: boolean): string {
44 html = html
45 .replace(/ ng-version=".*?"/g, '')
46 .replace(/ ng-server-context=".*?"/g, '')
47 .replace(/ ng-reflect-(.*?)=".*?"/g, '')
48 .replace(/ _nghost(.*?)=""/g, '')
49 .replace(/ _ngcontent(.*?)=""/g, '');
50 if (!keepNgh) {
51 html = html
52 .replace(NGH_ATTR_REGEXP, '')
53 .replace(EMPTY_TEXT_NODE_REGEXP, '')
54 .replace(TEXT_NODE_SEPARATOR_REGEXP, '');
55 }
56 return html;
57}
58
59/**
60 * Extracts a portion of HTML located inside of the `<body>` element.

Callers 3

getAppContentsFunction · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…