The absolute base identifier
The reference to relativize
A relative reference from base to reference, or the normalized absolute reference if not relativizable
RangeError If base is not a valid absolute identifier or reference is not a valid
relative reference, for instance because it carries an isolated UTF-16 surrogate or opens with //
Creates a relative reference from base to reference.
base, yieldsreferencebase:/…,file:///…): Returns the root-relative pathThe returned reference always resolves back to
referenceunder RFC 3986 § 5 and under any conforming URL parser, so callers may resolve it againstbasewithout further escaping. A first segment carrying a colon is prefixed with a./dot segment, so it cannot read as a scheme. Where an empty first segment would read as an authority, the absolute reference is returned instead, and root-relative paths for authority-less bases take a/.guard.