Is It Me or the Browser?
I had a Safari bug on a project I’m rushing to get out the door. We’re using a Flickr feed to populate a div
with link+thumbnail to some flickr images. In Firefox/Internet Explorer I simply did the following to build the links:
flickr : function(obj) {
//get the full list of items
var items = obj.getElementsByTagName("item");
//make sure it's not empty
if (items.length > 0 ) {
//start the HTML block
var blob = "<div id='flickrFeed'>";
//loop through the items (we only want 5) and build some links)
for (var i = 0; i< 5 ; i++) {
//get the link
var flink = items[i].getElementsByTagName("link")[0].childNodes[0].nodeValue;
//get the thumbnail
var flurl = items[i].getElementsByTagName("media:thumbnail")[0].getAttribute("url");
//smash them into the string
blob+="<a href='"+flink+"'><img height='75' width='75' src='"+flurl+"' /></a>";
};
//close the div
blob+="</div>";
//pop it onto the shelf, for later use
$("hyperspace").innerHTML+=blob;
} else {
//if there's somethign wrong with the feed, go to default contentk
social.fallBack.flickr();
}
}
Continue reading “getElementsByTagName Namespace Prefix Strangeness in Safari/Chrome/WebKit”