Skip to main content

COMPONENTS

Constant COMPONENTS 

Source
pub const COMPONENTS: &[&str];
Expand description

Parsed URL components. The component names a URL exposes as writable ACCESSORS on its prototype.

Assigning one has to rewrite the DERIVED fields — href, host and origin — which are stored alongside rather than computed on read. Without that, u.pathname = '/p' read back as /p while u.href still showed the old path, so the object disagreed with itself.

host and href are here too, and both need more than a write: host carries the port, and assigning href REPLACES the whole URL. Neither was settable, so u.href = 'http://x/y' stored a string that every other property then contradicted.