Open pex opened 8 years ago
@pex Good catch, www.foo.com
and google.com
should be treated as relative, the //
URL is valid though.
@pex Just following up, I'm still working on this, the primary issue I'm running into is that there doesn't seem to be a way to normalize if a url target begins with /
or not.
For example: html <a href="/some-article">Article</a> <a href="some-article">Article</a>
The only workaround I can currently think of is to run a final search/replace to convert any inputUrl//
to inputUrl/
Sorry for the delay on this, edge cases are giving me some grief.
Hej @sorensen I'm already glad you follow this up! Thanks for your help.
@pex So I apparently forgot to commit any code changes for this, but I think I have a working solution for you. Would you mind checking out the target-improvement branch and verifying?
Currently the following strings won't be changed corresponding to the tests:
www.foo.com
google.com
http://www.bar.com
//baz.com
from test.js:
Though I think targets without protocol (or
//
) are not valid URLs and should pass for being relative paths (in this test case this applies towww.foo.com
andgoogle.com
). AFAIK most browsers consider such targets as relative URLs, too.