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

Function escapeSelectorValue

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

Source from the content-addressed store, hash-verified

204}
205
206function escapeSelectorValue(value: string): string {
207 // Escape backslashes and double quotes to prevent CSS selector injection.
208 // This securely confines the value inside an attribute selector.
209 return `"${value.replace(/\\/g, '\\\\').replace(/"/g, '\\"')}"`;
210}
211
212function containsAttributes(tag: MetaDefinition, elem: HTMLMetaElement): boolean {
213 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