(e)
| 180 | * @visibleForTesting |
| 181 | */ |
| 182 | export function warmupDynamic(e) { |
| 183 | const link = getLinkInfo(e); |
| 184 | if (!link || !link.eventualUrl) { |
| 185 | return; |
| 186 | } |
| 187 | // Preloading with empty as and newly specced value `fetch` meaning the same |
| 188 | // thing. `document` would be the right value, but this is not yet supported |
| 189 | // in browsers. |
| 190 | const linkRel0 = /*OK*/ document.createElement('link'); |
| 191 | linkRel0.rel = 'preload'; |
| 192 | linkRel0.href = link.eventualUrl; |
| 193 | const linkRel1 = /*OK*/ document.createElement('link'); |
| 194 | linkRel1.rel = 'preload'; |
| 195 | linkRel1.as = 'fetch'; |
| 196 | linkRel1.href = link.eventualUrl; |
| 197 | const head = getHeadOrFallback(e.target.ownerDocument); |
| 198 | head.appendChild(linkRel0); |
| 199 | head.appendChild(linkRel1); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Return <head> if present or just the document element. |
no test coverage detected