* 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)
| 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()` |
no outgoing calls
no test coverage detected