MCPcopy Create free account
hub / github.com/angular/components / _prependPathToReferences

Method _prependPathToReferences

src/material/icon/icon.ts:405–419  ·  view source on GitHub ↗

* Prepends the current path to all elements that have an attribute pointing to a `FuncIRI` * reference. This is required because WebKit browsers require references to be prefixed with * the current path, if the page has a `base` tag.

(path: string)

Source from the content-addressed store, hash-verified

403 * the current path, if the page has a `base` tag.
404 */
405 private _prependPathToReferences(path: string) {
406 const elements = this._elementsWithExternalReferences;
407 // A path starting with `//` would otherwise be interpreted as a protocol-relative URL.
408 // Prefix it with a dot segment so it stays on the current origin without changing the resolved
409 // path.
410 const normalizedPath = path.startsWith('//') ? `/.${path}` : path;
411
412 if (elements) {
413 elements.forEach((attrs, element) => {
414 attrs.forEach(attr => {
415 element.setAttribute(attr.name, `url('${normalizedPath}#${attr.value}')`);
416 });
417 });
418 }
419 }
420
421 /**
422 * Caches the children of an SVG element that have `url()`

Callers 2

ngAfterViewCheckedMethod · 0.95
_setSvgElementMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected