Open domenic opened 6 years ago
The rationale is that a base URL is derived from a resource's URL (unless otherwise specified, e.g., with <base>
). The resource's URL is the real primitive. That's also why we call it import.meta.url
, not .baseURL
.
As noted in https://chromium.googlesource.com/chromium/src.git/+/282b0eeda63f32bb2ca2dbaa5ed42a4ca87378da, just "URL" is not actually correct, since for inline scripts it can be affected by <base>
. So, I'm inclined to close this.
It's still import.meta.url
for inline scripts though, right? It seems for style sheets we call this concept "location", though currently it's null for inline style sheets which seems rather broken as how would they resolve their URLs then? Owner node?
Yep, we used the shorter name for the API. It does sound like stylesheets are a bit broken?
Yeah maybe, CSS doesn't really define how it does fetching so... Should we strive for some more consistency between style sheets and scripts? (I realize I'm getting somewhat off-topic here.)
I think that would be good. They have somewhat similar models, with a "style sheet" spec struct vs. a "script" spec struct.
I guess the main problem here is that CSS has a rather bad track record when it comes to modeling. (Houdini mostly made it worse, it wasn't fixed at a fundamental level as far as I can tell.)
@annevk thinks this would be clearer, and asked me to file an issue to remind him. I think base URL is a good name for what it's used for (resolving relative imports), but will approve a PR to change it since @annevk seems to care strongly.