* Caches the children of an SVG element that have `url()` * references that we need to prefix with the current path.
(element: SVGElement)
| 417 | * references that we need to prefix with the current path. |
| 418 | */ |
| 419 | private _cacheChildrenWithExternalReferences(element: SVGElement) { |
| 420 | const elementsWithFuncIri = element.querySelectorAll(funcIriAttributeSelector); |
| 421 | const elements = (this._elementsWithExternalReferences = |
| 422 | this._elementsWithExternalReferences || new Map()); |
| 423 | |
| 424 | for (let i = 0; i < elementsWithFuncIri.length; i++) { |
| 425 | funcIriAttributes.forEach(attr => { |
| 426 | const elementWithReference = elementsWithFuncIri[i]; |
| 427 | const value = elementWithReference.getAttribute(attr); |
| 428 | const match = value ? value.match(funcIriPattern) : null; |
| 429 | |
| 430 | if (match) { |
| 431 | let attributes = elements.get(elementWithReference); |
| 432 | |
| 433 | if (!attributes) { |
| 434 | attributes = []; |
| 435 | elements.set(elementWithReference, attributes); |
| 436 | } |
| 437 | |
| 438 | attributes!.push({name: attr, value: match[1]}); |
| 439 | } |
| 440 | }); |
| 441 | } |
| 442 | } |
| 443 | |
| 444 | /** Sets a new SVG icon with a particular name. */ |
| 445 | private _updateSvgIcon(rawName: string | undefined) { |
no test coverage detected