Closed LeaVerou closed 3 years ago
The CSS Working Group just discussed URL Stuff
, and agreed to the following:
RESOLVED: Add a new url function that accepts only <string>, name tbd
I suggest naming the function uri(…)
, since URIs are a superset of URLs.
It would also match what the Java programming language did to avoid their legacy baggage involving URL processing.
https://url.spec.whatwg.org/#goals suggests avoiding URI and IRI (in favor of URL, in general)
Yeah, uri()
is dead in the water; the concept of URI/IRI is weird and not relevant here, plus it would (incorrectly) imply that this function somehow has more general functionality than url()
.
Dang tho, it's been 18 months here, I should just bite the bullet and add fetch()
And done. This work for you, @LeaVerou?
Shouldn’t https://github.com/w3c/csswg-drafts/commit/5b28aaab25fc1171c143d52186dfe32ca45f6d2d be done in a PR?
Wording seems fine, I'm still unsure if fetch()
is a good name. It's a verb, which implies that an action happens, whereas CSS is a declarative, reactive language, and its functions declare values, they do not perform actions. The semantics of this new function are identical to url()
, but the naming implies that it is completely different.
It's good to have it in the spec with any name, but I'm hoping we won't just resolve to that without discussion.
Let's put in on next week's agenda, yeah.
The CSS Working Group just discussed [css-values] Add url() alias that does not accept unquoted URLs
, and agreed to the following:
RESOLVED: Rename fetch() to src()
As discussed with @tabatkins during TPAC.
Due to the special way
url()
is parsed,var()
references cannot be used in it. Building URLs with variables is extremely useful in a number of cases. For example, specifying images independent of the image folder path, building URLs of flags from country codes, creating inline SVG data URIs and many more.Name of the new function TBB. Tab suggested
fetch()
but I think that is foreign to authors who don't know JS. Here are a few more ideas:href()
,src()
,location()
,get()
,uri()
,iri()
.