rewrite ADR #8 (Base Tag)

This commit is contained in:
Sunshine 2020-12-25 12:06:56 -10:00
parent d89b4d5f5b
commit 816b6175ac
No known key found for this signature in database
GPG key ID: B80CA68703CD8AB1

View file

@ -1,6 +1,6 @@
# 8. Base Tag # 8. Base Tag
Date: 2020-11-22 Date: 2020-12-25
## Status ## Status
@ -8,20 +8,33 @@ Accepted
## Context ## Context
HTML documents may contain `base` tag within `head`, which influences URL resolution prefix for anchor and relative links as well as dynamically loaded resources. Sometimes to make certain saved pages function closer to how they originally operated, the `base` tag specifying the source page's URL may need to be added to the document. HTML documents may contain `base` tag, which influences resolution of anchor links and relative URLs as well as dynamically loaded resources.
Sometimes, in order to make certain saved documents function closer to how they operate while being served from a remote server, the `base` tag specifying the source page's URL may need to be added to the document.
There can be only one such tag. If multiple `base` tags are present, only the first encountered tag ends up being used.
## Decision ## Decision
Adding the `base` tag should be optional. Saved documents should not contain the `base` tag unless it was requested by the user, or unless the document originally had the `base` tag in it. Only documents donwloaded from remote resources should be able to obtain a new `base` tag, existing `base` tags within documents saved from data URLs and local resources should be kept intact. Adding the `base` tag should be optional — saved documents should not contain the `base` tag unless it was specified by the user, or the document originally had the `base` tag in it.
The existing `href` attribute's value of the original `base` tag should be used for resolving document's relative links instead of document's own URL.
There can be only one such tag. If multiple `base` tags are provided, only the first encountered tag will end up being used. Existing `href` attribute's value of the original `base` tag should be used for resolving the document's relative links instead of document's own URL (precisely the way browsers do it).
## Consequences ## Consequences
In case the remote document had the `base` tag in it: #### If the base tag does not exist in the source document
- By default: the `href` attribute should be resolved to a full URL if it's relative, kept empty in case it was empty or non-existent, all other attributes of that tag should be kept intact.
- If `base` tag was requested to be added: the exsting `base` tag's `href` attribute should be set to page's full URL, all other attributes should be kept intact.
In case the remote document didn't have the `base` tag in it: - If the base tag does not exist in the source document
- By default: no `base` tag is added to the document, it gets saved to disk without having one. - With base URL option provided
- If `base` tag was requested to be added: the added `base` tag should contain only one attribute `href`, equal to the remote URL of that HTML document. - use the specified base URL value to retrieve assets, keep original base URL value in the document
- Without base URL option provided
- download document as usual, do not add base tag
- If the base tag already exists in the source document
- With base URL option provided
- we overwrite the original base URL before retrieving assets, keep new base URL value in the document
- Without base URL option provided:
- use the base URL from the original document to retrieve assets, keep original base URL value in the document
The program will obtain ability to retrieve remote assets for non-remote sources (such as data URLs and local files).
The program will obatin ability to get rid of existing base tag values (by provind an empty one).