Mogrol schrieb:
> Thanks for the reply Klaus
> 
> Both links matches if I, inside the function, do: if (this.href == src) 
> and when I run the script and watch the output of the alert they also 
> match. I tried your tip just to be sure though but it still doesn't 
> exclude the matching href :-/
> 
> Did'nt know that different browsers gave a different href reply in 
> javascript if the links are relative though - thanks for the tip!
> 
> Regards
> Jimmy

You may still have the problem because this.href != 
this.getAttribute('href'). Browsers put the resolved URL in the href 
property, but for getAttribute('href') some return the source value, 
some also the resolved value.

If jQuery uses getAttribute for its attribute selector - and that is 
what I assume - than your filter will not work, since you say that 
this.href == src, thus src must be an absolute url.

this.href == 'http://foo.com/bar' (resolved value)
src == 'http://foo.com/bar' (the value you put in)
getAttribute('href') == '/bar' != 'http://foo.com/bar' (this is what 
jQuery looks for in your :not expression)

So with your expression jQuery tries to filter all the links for which 
getAttribute('href') returns the value of your src variable without any 
match if and only if the link in question is a relative link in your 
html source.

Some more information about that topic:
http://www.quirksmode.org/bugreports/archives/2005/02/getAttributeHREF_is_always_absolute.html
http://www.glennjones.net/Post/809/getAttributehrefbug.htm (seems to be 
down at the moment).


-- klaus

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to