()
| 179 | } |
| 180 | |
| 181 | function scrollTargetIntoView(): void { |
| 182 | const {hash} = location; |
| 183 | if (!hash) { |
| 184 | return; |
| 185 | } |
| 186 | |
| 187 | const element = $optional(hash); |
| 188 | if (!element) { |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | const details = closestElementOptional('details', element); |
| 193 | if (details) { |
| 194 | details.open = true; |
| 195 | } |
| 196 | |
| 197 | element.scrollIntoView({ |
| 198 | block: 'start', |
| 199 | }); |
| 200 | |
| 201 | hasScrolledToTarget = true; |
| 202 | } |
| 203 | |
| 204 | async function init(): Promise<void> { |
| 205 | await generateDom(); |