|
20 | 20 | });
|
21 | 21 | });
|
22 | 22 |
|
23 |
| - function scrollTo(e: MouseEvent, tableCaption: string) { |
24 |
| - e.preventDefault(); |
| 23 | + function scrollTo(tableCaption: string) { |
| 24 | + const condition = tableCaption |
| 25 | + .split('|') |
| 26 | + .map((caption) => `contains(@data-navigation-tag,'${caption}')`) |
| 27 | + .join(' or '); |
25 | 28 | const el = document.evaluate(
|
26 |
| - `//caption[${tableCaption |
27 |
| - .split('|') |
28 |
| - .map((caption) => `contains(.,'${caption}')`) |
29 |
| - .join(' or ')}]`, |
| 29 | + `//node()[${condition}]`, |
30 | 30 | document,
|
31 | 31 | null,
|
32 | 32 | XPathResult.FIRST_ORDERED_NODE_TYPE,
|
|
49 | 49 | <a
|
50 | 50 | href="void(0)"
|
51 | 51 | class:panel-enabled={panels.eval && msg.callCounter.eval}
|
52 |
| - on:click={(e) => void scrollTo(e, 'Eval Usages')} |
| 52 | + on:click|preventDefault={() => void scrollTo('Eval Usages')} |
53 | 53 | >
|
54 | 54 | <strong>eval</strong>: <Variable bind:value={msg.callCounter.eval} />
|
55 | 55 | </a>
|
56 | 56 | <div class="divider" />
|
57 | 57 | <a
|
58 | 58 | href="void(0)"
|
59 | 59 | class:panel-enabled={panels.media && msg.mediaMetrics.total}
|
60 |
| - on:click={(e) => void scrollTo(e, 'Video|Audio')} |
| 60 | + on:click|preventDefault={() => void scrollTo('Videos|Audios')} |
61 | 61 | >
|
62 | 62 | <strong>Media</strong>:
|
63 | 63 | <Variable bind:value={msg.mediaMetrics.total} />
|
|
67 | 67 | href="void(0)"
|
68 | 68 | class:panel-enabled={panels.activeTimers &&
|
69 | 69 | msg.wrapperMetrics.onlineTimers}
|
70 |
| - on:click={(e) => void scrollTo(e, 'Active')} |
| 70 | + on:click|preventDefault={() => void scrollTo('Active')} |
71 | 71 | >
|
72 | 72 | <strong>Active Timers</strong>: <Variable
|
73 | 73 | bind:value={msg.wrapperMetrics.onlineTimers}
|
|
78 | 78 | href="void(0)"
|
79 | 79 | class:panel-enabled={panels.setTimeoutHistory &&
|
80 | 80 | msg.callCounter.setTimeout}
|
81 |
| - on:click={(e) => void scrollTo(e, 'setTimeout History')} |
| 81 | + on:click|preventDefault={() => void scrollTo('setTimeout History')} |
82 | 82 | >
|
83 | 83 | <strong>setTimeout</strong>: <Variable
|
84 | 84 | bind:value={msg.callCounter.setTimeout}
|
|
89 | 89 | href="void(0)"
|
90 | 90 | class:panel-enabled={panels.clearTimeoutHistory &&
|
91 | 91 | msg.callCounter.clearTimeout}
|
92 |
| - on:click={(e) => void scrollTo(e, 'clearTimeout History')} |
| 92 | + on:click|preventDefault={() => void scrollTo('clearTimeout History')} |
93 | 93 | >
|
94 | 94 | <strong>clearTimeout</strong>: <Variable
|
95 | 95 | bind:value={msg.callCounter.clearTimeout}
|
|
100 | 100 | href="void(0)"
|
101 | 101 | class:panel-enabled={panels.setIntervalHistory &&
|
102 | 102 | msg.callCounter.setInterval}
|
103 |
| - on:click={(e) => void scrollTo(e, 'setInterval History')} |
| 103 | + on:click|preventDefault={() => void scrollTo('setInterval History')} |
104 | 104 | >
|
105 | 105 | <strong>setInterval</strong>: <Variable
|
106 | 106 | bind:value={msg.callCounter.setInterval}
|
|
111 | 111 | href="void(0)"
|
112 | 112 | class:panel-enabled={panels.clearIntervalHistory &&
|
113 | 113 | msg.callCounter.clearInterval}
|
114 |
| - on:click={(e) => void scrollTo(e, 'clearInterval History')} |
| 114 | + on:click|preventDefault={() => void scrollTo('clearInterval History')} |
115 | 115 | >
|
116 | 116 | <strong>clearInterval</strong>: <Variable
|
117 | 117 | bind:value={msg.callCounter.clearInterval}
|
|
0 commit comments