Skip to content

Replace fallback base URL with DOM's base URL override - #12674

Open
annevk wants to merge 2 commits into
mainfrom
base-url-clone
Open

Replace fallback base URL with DOM's base URL override#12674
annevk wants to merge 2 commits into
mainfrom
base-url-clone

Conversation

@annevk

@annevk annevk commented Jul 11, 2026

Copy link
Copy Markdown
Member

Replace fallback base URL with DOM's base URL override

A Document's base URL now comes from a single field, DOM's base URL override, replacing the fallback base URL and a Document's about base URL. The document base URL consults it when there is no base element. It is populated at creation for "about:"-schemed Documents from the initiator's base URL, and by DOM when a Document is cloned, so that a clone without a base element reports the base URL of the Document it was cloned from. DOM's baseURI getter defers to a new get the base URL algorithm, which this specification overrides to return the document base URL, so DOM no longer reaches into HTML for a value returned by a DOM API.

As a consequence a base element resolves its href against its Document's URL instead of the inherited base URL. A relative href in an "about:"-schemed Document therefore no longer resolves, as those URLs have an opaque path; ordinary relative URLs keep inheriting.

See whatwg/dom#454.

Tests: web-platform-tests/wpt#61231 & web-platform-tests/wpt#61232.

(See WHATWG Working Mode: Changes for more details.)


/browsing-the-web.html ( diff )
/document-lifecycle.html ( diff )
/document-sequences.html ( diff )
/dom.html ( diff )
/infrastructure.html ( diff )
/semantics.html ( diff )
/urls-and-fetching.html ( diff )

Define a Document's get the base URL algorithm, used by DOM's baseURI getter,
to return the document base URL. And have the document base URL take the base
URL override into account, which DOM sets when a document is cloned, so that a
clone without a base element reports the base URL of the document it was cloned
from.

See whatwg/dom#454.

Tests: web-platform-tests/wpt#61232
@annevk annevk changed the title Account for a cloned document's base URL Replace fallback base URL with DOM's base URL override Aug 20, 2026
Remove the fallback base URL and a Document's about base URL, and have
the document base URL consult DOM's base URL override instead. A base
element now resolves its href against its Document's URL.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant