Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

`src` takes a path, not a URL.

I think you just misunderstand what a URL is.



I would think of it as a "URI-reference" (a URL or a relative ref), since `src` can be thinks like "https://example.com/test.png" (absolute URI, not a path) or "//example.com/foo.png" (relative, not a path).

The bigger point is yeah, type T isn't a parser for type U.

I guess unfortunately, I'm not sure if there is a URI-ref parser in JS that I know of … but does one ever want to do that, without first normalizing it over a base URI?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: