(url: string)
| 142 | */ |
| 143 | let anchor: HTMLAnchorElement | undefined; |
| 144 | function resolveUrl(url: string): {pathname: string; search: string; hash: string} { |
| 145 | anchor ??= document.createElement('a'); |
| 146 | |
| 147 | anchor.setAttribute('href', url); |
| 148 | anchor.setAttribute('href', anchor.href); |
| 149 | |
| 150 | return { |
| 151 | // IE does not start `pathname` with `/` like other browsers. |
| 152 | pathname: `/${anchor.pathname.replace(/^\//, '')}`, |
| 153 | search: anchor.search, |
| 154 | hash: anchor.hash, |
| 155 | }; |
| 156 | } |
no test coverage detected
searching dependent graphs…