Stephan Beal wrote:
Hi, all!
i noticed the following today (jQ v1.1.3.1):
var lbl = jQuery("<a href='#foo'/>");
alert( lbl.attr('href') ); // == "#foo"
alert( lbl[0].href ); // == "http://my.site/path/#foo"
My questions are:
a) What is the reason (if any) for this discrepancy?
b) Is this a jQ bug?
i would expect .attr('href') to return the same thing as elem.href.
In this case attr("href") is the same as lbl[0].getAttribute("href") and
it adds an additional argument when calling that in IE. That you get the
full URL using element.href and the value actually specified via
attr("href").
--
Jörn Zaefferer
http://bassistance.de