tracker: 16.0.3, fix local spritemap parsing
This commit is contained in:
parent
1e2dde09b4
commit
7e065ab02f
5 changed files with 28 additions and 4 deletions
Binary file not shown.
Binary file not shown.
|
|
@ -1,3 +1,7 @@
|
||||||
|
## 16.0.3
|
||||||
|
|
||||||
|
- better handling for local svg spritemaps
|
||||||
|
|
||||||
## 16.0.2
|
## 16.0.2
|
||||||
|
|
||||||
- fix attributeSender key generation to prevent calling native methods on objects
|
- fix attributeSender key generation to prevent calling native methods on objects
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@openreplay/tracker",
|
"name": "@openreplay/tracker",
|
||||||
"description": "The OpenReplay tracker main package",
|
"description": "The OpenReplay tracker main package",
|
||||||
"version": "16.0.2",
|
"version": "16.0.3",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"logging",
|
"logging",
|
||||||
"replay"
|
"replay"
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,29 @@ async function parseUseEl(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const [url, symbolId] = href.split('#')
|
let [url, symbolId] = href.split('#')
|
||||||
if (!url || !symbolId) {
|
|
||||||
console.debug('Openreplay: Invalid xlink:href or href found on <use>.')
|
// happens if svg spritemap is local, fastest case for us
|
||||||
|
if (!url && symbolId) {
|
||||||
|
const symbol = document.querySelector(href)
|
||||||
|
if (symbol) {
|
||||||
|
const inlineSvg = `
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="${symbol.getAttribute('viewBox') || '0 0 24 24'}">
|
||||||
|
${symbol.innerHTML}
|
||||||
|
</svg>
|
||||||
|
`.trim()
|
||||||
|
|
||||||
|
iconCache[symbolId] = inlineSvg
|
||||||
|
|
||||||
|
return inlineSvg
|
||||||
|
} else {
|
||||||
|
console.warn('Openreplay: Sprite symbol not found in the document.')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!url && !symbolId) {
|
||||||
|
console.warn('Openreplay: Invalid xlink:href or href found on <use>.')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue