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

Function escapeSelectorValue

packages/platform-browser/src/browser/meta.ts:188–192  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

186}
187
188function escapeSelectorValue(value: string): string {
189 // Escape backslashes and double quotes to prevent CSS selector injection.
190 // This securely confines the value inside an attribute selector.
191 return `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
192}
193
194function containsAttributes(tag: MetaDefinition, elem: HTMLMetaElement): boolean {
195 return Object.keys(tag).every((key) => elem.getAttribute(getMetaKeyMap(key)) === tag[key]);

Callers 1

parseSelectorFunction · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected