To parse a URLurl into its
component parts, the user agent must use the parse
an address algorithm defined by the IRI specification. [RFC3987]

Parsing a URL can fail. If it does not, then it results in the
following components, again as defined by the IRI specification:

<scheme>

<host>

<port>

<hostport>

<path>

<query>

<fragment>

<host-specific>

To resolve a URL to an absolute URL
relative to either another absolute URL or an element,
the user agent must use the following steps. Resolving a URL can
result in an error, in which case the URL is not resolvable.

Otherwise, let base be the base URI of
the element, as defined by the XML Base specification, with
the base URI of the document entity being defined as the
document base URL of the Document that
owns the element. [XMLBASE]

For the purposes of the XML Base specification, user agents
must act as if all Document objects represented XML
documents.

It is possible for xml:base attributes to be present
even in HTML fragments, as such attributes can be added
dynamically using script. (Such scripts would not be conforming,
however, as xml:base attributes
are not allowed in HTML documents.)

The term "URL" in this specification is used in a
manner distinct from the precise technical meaning it is given in
RFC 3986. Readers familiar with that RFC will find it easier to read
this specification if they pretend the term "URL" as used
herein is really called something else altogether. This is a
willful violation of RFC 3986. [RFC3986]

If the absolute URL identified by the hyperlink is
being shown to the user, or if any data derived from that URL is
affecting the display, then the href attribute should be re-resolved relative to the element
and the UI updated appropriately.

For example, the CSS :link/:visited pseudo-classes might have
been affected.

If the absolute URL identified by the cite attribute is being shown to the user, or if
any data derived from that URL is affecting the display, then the
URL should be re-resolved relative to the element and the UI updated
appropriately.

Otherwise

The element is not directly affected.

Changing the base URL doesn't affect the image
displayed by img elements, although subsequent
accesses of the src IDL attribute
from script will return a new absolute URL that might
no longer correspond to the image being shown.

2.6.3 Interfaces for URL manipulation

An interface that has a complement of URL decomposition IDL
attributes has seven attributes with the following
definitions:

In addition, an interface with a complement of URL
decomposition IDL attributes defines an input, which is a URL
that the attributes act on, and a common setter action, which is a
set of steps invoked when any of the attributes' setters are
invoked.

On getting, if the input
is an absolute URL that fulfills the condition given in
the "getter condition" column corresponding to the attribute in the
table below, the user agent must return the part of the input URL given in the "component"
column, with any prefixes specified in the "prefix" column
appropriately added to the start of the string and any suffixes
specified in the "suffix" column appropriately added to the end of
the string. Otherwise, the attribute must return the empty
string.

On setting, the new value must first be mutated as described by
the "setter preprocessor" column, then mutated by %-escaping any
characters in the new value that are not valid in the relevant
component as given by the "component" column. Then, if the input is an absolute
URL and the resulting new value fulfills the condition given
in the "setter condition" column, the user agent must make a new
string output by replacing the component of the
URL given by the "component" column in the input URL with the new value;
otherwise, the user agent must let output be
equal to the input. Finally,
the user agent must invoke the common setter action with the
value of output.

When replacing a component in the URL, if the component is part
of an optional group in the URL syntax consisting of a character
followed by the component, the component (including its prefix
character) must be included even if the new value is the empty
string.

The previous paragraph applies in particular to the
":" before a <port> component, the "?" before a <query> component, and the "#" before a <fragment> component.

For the purposes of the above definitions, URLs must be parsed
using the URL parsing rules defined
in this specification.

Remove all characters in the new value from the first that is not in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), if any.
Remove any leading U+0030 DIGIT ZERO characters (0) in the new value.
If the resulting string is empty, set it to a single U+0030 DIGIT ZERO character (0).

input is an authority-based URL,
and the new value, when interpreted as a base-ten integer, is less than or equal to 65535