Looks like the fragment case was missed in https://bugs.webkit.org/show_bug.cgi?id=69211. Originally found in https://code.google.com/p/chromium/issues/detail?id=105535.
Empty URL is a special case in HTML5. We'll need new research for src="#", and a change in the spec if it's warranted. See <http://lists.whatwg.org/htdig.cgi/whatwg-whatwg.org/2009-December/024357.html> for a discussion that resulted in changing the spec for empty URLs. What do other browsers do?
I used following test cases: 1. <img src=""></img> 2. <img src="#"></img> 3. <img src="#test"></img> Opera 11 makes only one request (main document) in each case, so they are ignoring fragment and consider "#" an empty url. Firefox 3.6 makes one request in the first case and two in other cases. Firefox 8 makes two requests in each case (so they are making two requests for src="" again!) Chromium/Safari with ToT webkit make one request in the first case and two in other cases as we would expect.
> Firefox 8 makes two requests in each case (so they are making two requests for src="" again!) Please file a bugzilla.mozilla.org bug for them to fix. > Chromium/Safari with ToT webkit make one request in the first case and two in other cases as we would expect. Getting a spec change first is probably the best way to go about this. Would you be willing to e-mail WHATWG?
How common is this? Unless it's really common (why would it be?) I'd suggest not doing anything special for the latter two cases. (src="" is common because it's the default value.)