Skip to content

Improve misleading examples#44304

Open
jmorahan wants to merge 1 commit into
mdn:mainfrom
jmorahan:patch-1
Open

Improve misleading examples#44304
jmorahan wants to merge 1 commit into
mdn:mainfrom
jmorahan:patch-1

Conversation

@jmorahan
Copy link
Copy Markdown

The examples for how relative URLs are constructed, while technically correct, give a misleading impression that ../ is needed to get from /dogs to /cats, which is not the case. This replaces those examples with clearer ones.

Description

Replaces

new URL("../cats", "http://www.example.com/dogs");

with

new URL("cats", "http://www.example.com/animals/dogs");

and adjusts anything else that needs to change as a result.

Motivation

The previous example might mislead readers into thinking that relative URLs are constructed by always treating the last path element as if it ends with a trailing slash.

The examples for how relative URLs are constructed, while technically correct, give a misleading impression that `../` is needed to get from `/dogs` to `/cats`, which is not the case. This replaces those examples with clearer ones.
@jmorahan jmorahan requested a review from a team as a code owner May 30, 2026 09:05
@jmorahan jmorahan requested review from hamishwillee and removed request for a team May 30, 2026 09:05
@github-actions github-actions Bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels May 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants