{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/url/issues/71","labels_url":"https://api.github.com/repos/whatwg/url/issues/71/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/url/issues/71/comments","events_url":"https://api.github.com/repos/whatwg/url/issues/71/events","html_url":"https://github.com/whatwg/url/issues/71","id":105629615,"number":71,"title":"Good defaults on URL()","user":{"login":"LeaVerou","id":175836,"avatar_url":"https://avatars.githubusercontent.com/u/175836?v=3","gravatar_id":"","url":"https://api.github.com/users/LeaVerou","html_url":"https://github.com/LeaVerou","followers_url":"https://api.github.com/users/LeaVerou/followers","following_url":"https://api.github.com/users/LeaVerou/following{/other_user}","gists_url":"https://api.github.com/users/LeaVerou/gists{/gist_id}","starred_url":"https://api.github.com/users/LeaVerou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeaVerou/subscriptions","organizations_url":"https://api.github.com/users/LeaVerou/orgs","repos_url":"https://api.github.com/users/LeaVerou/repos","events_url":"https://api.github.com/users/LeaVerou/events{/privacy}","received_events_url":"https://api.github.com/users/LeaVerou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":37,"created_at":"2015-09-09T16:08:44Z","updated_at":"2015-09-09T17:28:53Z","closed_at":null,"body":"Let’s not make the `addEventListener()` mistake again with the pointless 3rd argument. Web APIs need reasonable defaults.\r\nMost uses of relative URLs in the `URL()` constructor would be against the document URL [citation needed :P]\r\nWe should define the 2nd argument to be `location` by default in contexts where that is available. This can be changed without breaking backwards compat."},"comment":{"url":"https://api.github.com/repos/whatwg/url/issues/comments/138984166","html_url":"https://github.com/whatwg/url/issues/71#issuecomment-138984166","issue_url":"https://api.github.com/repos/whatwg/url/issues/71","id":138984166,"user":{"login":"tabatkins","id":682840,"avatar_url":"https://avatars.githubusercontent.com/u/682840?v=3","gravatar_id":"","url":"https://api.github.com/users/tabatkins","html_url":"https://github.com/tabatkins","followers_url":"https://api.github.com/users/tabatkins/followers","following_url":"https://api.github.com/users/tabatkins/following{/other_user}","gists_url":"https://api.github.com/users/tabatkins/gists{/gist_id}","starred_url":"https://api.github.com/users/tabatkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tabatkins/subscriptions","organizations_url":"https://api.github.com/users/tabatkins/orgs","repos_url":"https://api.github.com/users/tabatkins/repos","events_url":"https://api.github.com/users/tabatkins/events{/privacy}","received_events_url":"https://api.github.com/users/tabatkins/received_events","type":"User","site_admin":false},"created_at":"2015-09-09T17:28:53Z","updated_at":"2015-09-09T17:28:53Z","body":"@LeaVerou That's what happens when you create an `<a>` not in the document, yeah. And when it's in the document, it uses the document's base url.  And neither is the origin, which is what @slightlyoff was talking about defaulting with.\r\n\r\nYou can't auto-resolve a relative url against `location` and expect it to be \"what it would resolve to if this was a link in the page\", because `<base>`.  You can't expect it to be \"what it would resolve to if this was in a CSS url() function\", because that's the stylesheet's url.  You can't input what you assume is an absolute url and get what you expect, if the string is user input and might be nonsense (it'll get interpreted as a nonsense relative url).  Auto-assuming the base is a *footgun*, and it'll bite people.  You need to specify what your base is, because there are multiple valid choices, and it's a valid choice to say \"none\" because you're expecting an absolute url.\r\n\r\n(For a \"must be absolute\" use-case, assume you're setting your avatar, and you can upload from your computer or provide a url.  Relative urls are nonsense here; even if you did want, for some reason, to use a picture on the domain, it's easiest to right-click=>copy link address, which gives you an absolute url.  If someone *does* insert something that's not an absolute url, it's *very likely* to be an error, and throwing is good behavior here.)"}}