[whatwg] URL decomposition on HTMLAnchorElement interface
lists.whatwg at stakface.com
Thu Mar 26 14:26:46 PDT 2009
> If you specify the setters then you also need to specify how this
> affects the value of the "href" attribute in the DOM. For example, in
> Gecko if you have an <a href="foo#bar"> which has base URI
> "http://example.com/" and you set anchor.hash on that anchor to "baz",
> then the attribute value is changed to "http://example.com/foo#baz".
I was trying different things to see what happens and came across some particularly weird behavior in Gecko/2009021910 Firefox/3.0.7:
var a = document.createElement('a');
a.hostname = null;
alert(a.hostname); // displays "foo"
alert(a.href); // displays "http://foo/?bar#baz"
a.host = null;
alert(a.host); // displays ""
alert(a.pathname); // displays ""
alert(a.href); // displays "scheme:////host/path"
This behavior seems rather inconsistent and possibly buggy. I tried looking in Bugzilla to see if anything turned up but my search keywords just kept hitting a lot of unrelated stuff so I didn't try too hard.
More information about the whatwg