Skip to content

Commit

Permalink
Updating so that it utilizes this.selector so the MutationObserver wa…
Browse files Browse the repository at this point in the history
…tches for elements with the original plugin selector.
  • Loading branch information
jermartin77 committed Feb 27, 2017
1 parent 3643dcf commit 8e75406
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions js/inline-svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
var options = {

};


var selector = this.selector;

$.extend( options, args );

//function to inline SVGs as part of the jquery plugin or part of the MutationObserver event.
Expand Down Expand Up @@ -40,12 +42,12 @@
//}
});

//observe the DOM for mutations, if anything changes on the page scan it for new img.inline-svg
//observe the DOM for mutations, if anything changes on the page scan it for new img selector
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {

if (mutation.type === 'childList' && mutation.addedNodes.length) {
var $inlineSVGs = $("img.inline-svg").not('.loaded');
var $inlineSVGs = $("img" + selector).not('.loaded');

$inlineSVGs.each(function(){
makeSVGInline($(this));
Expand Down

0 comments on commit 8e75406

Please sign in to comment.