Bug 20608 - host and hostname properties return incorrect (opposite) values
Summary: host and hostname properties return incorrect (opposite) values
Status: RESOLVED DUPLICATE of bug 28954
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 525.x (Safari 3.1)
Hardware: Macintosh OS X 10.5
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2008-09-02 14:34 PDT by Vladimir Olexa (vladinecko)
Modified: 2009-09-04 12:41 PDT (History)
1 user (show)

See Also:

Test case (422 bytes, text/html)
2008-09-02 14:35 PDT, Vladimir Olexa (vladinecko)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Olexa (vladinecko) 2008-09-02 14:34:28 PDT
if you have a link like <a href="http://www.apple.com:89234">my link</a> and then try to access its properties, link.host returns "www.apple.com" while hostname returns "www.apple.com:89234"

i believe those values should be swapped; host should return the full host name including port number and hostname should just return the host name. 

this is happening in shipping safari 3.1 as well as nightly build.
Comment 1 Vladimir Olexa (vladinecko) 2008-09-02 14:35:29 PDT
Created attachment 23126 [details]
Test case

simple test case to showcase the bug
Comment 2 Sam Weinig 2008-09-02 16:59:24 PDT
I believe we do it this way to match IE.
Comment 3 Vladimir Olexa (vladinecko) 2008-09-07 12:22:27 PDT
like many other things in IE, this is one of those that completely doesn't make sense and is counterintuitive. 

wouldn't we rather want to match firefox in behavior?  

(In reply to comment #2)
> I believe we do it this way to match IE.
Comment 4 Przemyslaw Pawelczyk 2008-09-26 07:23:48 PDT
Better test case: http://old.przemoc.net:81/host.html

Location is a kind of link, so if location's host and hostname properties works in every browser exactly the same, then it must be truth for ordinary links.

Results (Windows):
Gecko (Fx 3) - correct
IE 5/6/7 - correct
WebKit (Chrome, Opera 9.5, Safari 3.1) - incorrect
Comment 5 Alexey Proskuryakov 2008-09-26 11:46:09 PDT
Thanks, confirmed as a difference with IE 7 and Firefox 3.

(In reply to comment #4)
> WebKit (Chrome, Opera 9.5, Safari 3.1) - incorrect

Please note that Opera doesn't use WebKit. Maybe there is a reason behind this quirk if two engines have it  -but on the linked test case, it seems to be clear that we are in error.
Comment 6 Alexey Proskuryakov 2009-09-04 12:41:47 PDT

*** This bug has been marked as a duplicate of bug 28954 ***