* Determines whether a serialized path would produce a protocol-relative URL when interpreted * by a browser or server. Under the WHATWG URL standard, paths starting with `//` or `/\`, or paths * where leading dot segments collapse to `//` (such as `/.//` or `/..//`), resolve to an external * ori
(url: string)
| 507 | * origin or a protocol-relative pathname. |
| 508 | */ |
| 509 | function isProtocolRelative(url: string): boolean { |
| 510 | try { |
| 511 | const resolved = new URL(url, DUMMY_BASE_URL); |
| 512 | return resolved.origin !== DUMMY_BASE_URL || resolved.pathname.startsWith('//'); |
| 513 | } catch { |
| 514 | return true; |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | const DEFAULT_SERIALIZER = new DefaultUrlSerializer(); |
| 519 |