From 012500f82a5645ad56f2dd26a528b5f5dff294b0 Mon Sep 17 00:00:00 2001 From: Joe Palmer Date: Sat, 27 Feb 2016 22:35:57 +0000 Subject: [PATCH] Mismatch when looking up referencing elements If you have filter="url(#filter-10)" but are searching for just filter-1, this will get matched. This is what happens in Sketch when you have to 10 or more filters. Not sure if this will cause a problem with some versions of IE. --- svg-injector.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/svg-injector.js b/svg-injector.js index 08de011..6027c2f 100644 --- a/svg-injector.js +++ b/svg-injector.js @@ -307,7 +307,7 @@ var referencingElements; forEach.call(properties, function (property) { // :NOTE: using a substring match attr selector here to deal with IE "adding extra quotes in url() attrs" - referencingElements = svg.querySelectorAll('[' + property + '*="' + currentId + '"]'); + referencingElements = svg.querySelectorAll('[' + property + '="url(#' + currentId + ')"]'); for (var j = 0, referencingElementLen = referencingElements.length; j < referencingElementLen; j++) { referencingElements[j].setAttribute(property, 'url(#' + newId + ')'); }