This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23474 - Spec what should happen when setting host to an empty string
Summary: Spec what should happen when setting host to an empty string
Status: RESOLVED WORKSFORME
Alias: None
Product: WHATWG
Classification: Unclassified
Component: URL (show other bugs)
Version: unspecified
Hardware: All Linux
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+urlspec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-09 20:30 UTC by Erik Arvidsson
Modified: 2014-01-13 18:12 UTC (History)
2 users (show)

See Also:


Attachments

Description Erik Arvidsson 2013-10-09 20:30:24 UTC
Gecko:

a.href = 'http://abc.de:8080/path/name?search#hash'
a.host = '';
a.href // 'http://path/name?search#hash' 

Blink ignores empty strings:

a.href = 'http://abc.de:8080/path/name?search#hash'
a.host = '';
a.href // 'http://abc.de:8080/path/name?search#hash'

IE11:

a.href = 'http://abc.de:8080/path/name?search#hash'
a.host = '';
a.href // 'http://:8080/path/name?search#hash'

Gecko's solution which follows the spec most closely is bad since it results in a string that has the path as the new domain

IE's solution leads to an invalid URL.
Comment 1 Anne 2013-10-15 12:38:16 UTC
Blink is correct per the specification as far as I can tell.

Per http://url.spec.whatwg.org/#host-state with c being EOF you parse "host" (which is the empty string) which leads to failure which leads to URL's host not changing.