Skip to content

Commit 588473a

Browse files
committed
[css-values-4] Add note and example to clarify implications of new URL resolution method. #3320
1 parent 4f5e343 commit 588473a

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

css-values-4/Overview.bs

+20-5
Original file line numberDiff line numberDiff line change
@@ -962,11 +962,23 @@ Fragment URLs</h5>
962962
This reference must always be treated as same-document
963963
(rather than cross-document).
964964

965-
Note: This means that stylesheets inside a [=shadow tree=]
966-
will resolve these URLs only to elements inside the shadow,
967-
elements in the light DOM
968-
will resolve these URLs only to elements in the light DOM,
969-
etc.
965+
Note: This means that such fragments will resolve
966+
against the contents of the current document
967+
(and in consideration of shadow DOM, only within the stylesheet's associated [=node tree=]),
968+
regardless of what base URL relative URLs outside of CSS resolve against.
969+
970+
<div class="example">
971+
In the following example,
972+
<code>#anchor</code> will resolve against <code>http://example.com/</code>
973+
whereas <code>#image</code> will resolve against the elements in the HTML document itself:
974+
975+
<xmp highlight=html>
976+
<!DOCTYPE html>
977+
<base href="http://example.com/">
978+
...
979+
<a href="#anchor" style="background-image: url(#image)">link</a>
980+
</xmp>
981+
</div>
970982

971983
When <a href="https://www.w3.org/TR/cssom-1/#serializing-css-values">serializing</a>
972984
a ''url()'' with the <a>local url flag</a> set,
@@ -4961,6 +4973,9 @@ Recent Changes</h3>
49614973
Substantial changes since <a href="https://www.w3.org/TR/2021/WD-css-values-4-20211216/">16 December 2021 WD</a>:
49624974

49634975
<ul>
4976+
<li>Changed resolution of a ''url()'' with the [=local url flag=]
4977+
to reference the current [=node tree=] (regardless of document base URL modifications).
4978+
(<a href="https://github.com/w3c/csswg-drafts/issues/3320">Issue 3320</a>)
49644979
<li>Switched censoring of ''NaN'' that escapes a [=math function=] from infinity to zero.
49654980
(<a href="https://github.com/w3c/csswg-drafts/issues/7067">Issue 7067</a>)
49664981
<li>Added [[#linked-properties]] to allow this property pattern to be easily referenced.

0 commit comments

Comments
 (0)