Problems getting attribute xlink:href in Safari browser

L

Lance Dyas

I have managed to get the xml to load using the xmlHTTPrequest...
(inspite of premature readyState 4) the problem now arises
in Safari alone...

var thelink = node.getAttribute("xlink:href")

Works in other browsers... except Safari, where
it always returns null

Any ideas?
 
M

Martin Honnen

Lance Dyas wrote:

var thelink = node.getAttribute("xlink:href")

Assuming the prefix xlink is bound to the namespace URI
http://www.w3.org/1999/xlink you could try

var theLink;
if (typeof node.getAttributeNS != 'undefined') {
theLink = node.getAttributeNS('http://www.w3.org/1999/xlink', 'href');
}
else {
theLink = node.getAttribute('xlink:href');
}

I don't have time to test that now with a Safari browser but if you are
scripting XML with namespace then the namespace relevant methods of DOM
Level 2 like getAttributeNS or getElementsByTagNameNS should be used if
supported by the implementation.
 
L

Lance Dyas

Thanks for the response... my exposure to SVG and scripting within
its various implementations had me trying almost exactly that as of a
month ago there was no joy in Safari (or any other browser for the name
space method), but since there have been a few Safari patches
since then, I might give it another go.
 
L

Lance Dyas

Just wanted to mention this worked quite nicely, it is a good sign when
browsers do start paying attention to standards!
 
R

Randy Webb

Lance Dyas said the following on 10/5/2005 8:15 PM:
Just wanted to mention this worked quite nicely, it is a good sign when
browsers do start paying attention to standards!

Now, if we can just get posters to read and adhere to desired practices
as explained in the groups FAQ. See signature below.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top