Handle missing rel attribute on matching <link> in DC prefix search

This commit is contained in:
Dan Stillman 2009-05-27 08:12:20 +00:00
parent 3f9e9d0cf4
commit 47be01a6ae

View file

@ -23,9 +23,11 @@ function getDCPrefix(doc) {
for(var i=0; i<links.length; i++) {
if(links[i].getAttribute("href") == _dc) {
var rel = links[i].getAttribute("rel");
var matches = rel.match(/^schema\.([a-zA-Z]+)/);
if(matches) {
_prefix = matches[1].toLowerCase() + ".";
if(rel) {
var matches = rel.match(/^schema\.([a-zA-Z]+)/);
if(matches) {
_prefix = matches[1].toLowerCase() + ".";
}
}
break;
}