Permalink
Browse files

Merge pull request #2 from jkphl/master

Fix failing size() calls & exclude dataURIs from xlink:href detection
  • Loading branch information...
2 parents fa7da1b + 3f0f978 commit 8a119105ff411a94c06e72a61e9c6f24d113267a @rockitbaby rockitbaby committed Feb 19, 2014
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/svg-cleaner.js
View
@@ -217,7 +217,7 @@ function findReferencedElements() {
// if xlink:href is set, then grab the id
var href = $node.attr('xlink:href');
- if(href) {
+ if(href && (href.indexOf('data:') !== 0)) {
addReferencingElement(ids, href, REFERENCE_TYPE.XLINK, node);
}
@@ -266,7 +266,7 @@ function shortenIDs(startNumber) {
// > (Cyn: I've seen documents with #id references but no element with that ID!)
var idList = _(_(referencedIDs).keys()).filter(function(id) {
- return ($identifiedElements.find('#' + id).size() > 0);
+ return ($identifiedElements.find('#' + id).length > 0);
});
idList = _(idList).sortBy(function(id) {
return referencedIDs[id].length;
@@ -283,7 +283,7 @@ function shortenIDs(startNumber) {
}
// scour:
// > Then, skip ahead if the new ID is already in identifiedElement
- while($identifiedElements.find('#' + shortendID).size() > 0) {
+ while($identifiedElements.find('#' + shortendID).length > 0) {
shortendID = intToID(startNumber++);
}
// scour:

0 comments on commit 8a11910

Please sign in to comment.