Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing size() calls & exclude dataURIs from xlink:href detection #2

Merged
merged 2 commits into from Feb 19, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/svg-cleaner.js
Expand Up @@ -217,7 +217,7 @@ function findReferencedElements() {


// if xlink:href is set, then grab the id // if xlink:href is set, then grab the id
var href = $node.attr('xlink:href'); var href = $node.attr('xlink:href');
if(href) { if(href && (href.indexOf('data:') !== 0)) {
addReferencingElement(ids, href, REFERENCE_TYPE.XLINK, node); addReferencingElement(ids, href, REFERENCE_TYPE.XLINK, node);
} }


Expand Down Expand Up @@ -266,7 +266,7 @@ function shortenIDs(startNumber) {
// > (Cyn: I've seen documents with #id references but no element with that ID!) // > (Cyn: I've seen documents with #id references but no element with that ID!)


var idList = _(_(referencedIDs).keys()).filter(function(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) { idList = _(idList).sortBy(function(id) {
return referencedIDs[id].length; return referencedIDs[id].length;
Expand All @@ -283,7 +283,7 @@ function shortenIDs(startNumber) {
} }
// scour: // scour:
// > Then, skip ahead if the new ID is already in identifiedElement // > 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++); shortendID = intToID(startNumber++);
} }
// scour: // scour:
Expand Down