By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

Problems getting attribute xlink:href in Safari browser

P: n/a
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?
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Oct 5 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a


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.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 5 '05 #2

P: n/a
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.

Martin Honnen wrote:


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.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Oct 5 '05 #3

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

Martin Honnen wrote:


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.


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Oct 6 '05 #4

P: n/a
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?
Oct 6 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.