Fixed footnotes in IE11. Fixes #573

This commit is contained in:
benweet 2014-12-15 00:30:57 +00:00
parent 59f5044232
commit 2d2cedd174

View File

@ -104,10 +104,14 @@ define([
}
var footnoteMap = {};
var footnoteFragment = document.createDocumentFragment();
// Store one footnote elt in the footnote map
function storeFootnote(footnoteElt) {
var id = footnoteElt.id.substring(3);
var oldFootnote = footnoteMap[id];
oldFootnote && footnoteFragment.removeChild(oldFootnote);
footnoteMap[id] = footnoteElt;
footnoteFragment.appendChild(footnoteElt);
}
var footnoteContainerElt;
@ -179,7 +183,12 @@ define([
}, crel('hr'), footnoteElts));
}
// Keep used footnotes only in our map
footnoteMap = _.pick(footnoteMap, usedFootnoteIds);
Object.keys(footnoteMap).forEach(function(key) {
if(usedFootnoteIds.indexOf(key) === -1) {
footnoteFragment.removeChild(footnoteMap[key]);
delete footnoteMap[key];
}
});
}
}