Unset attributes in img that aren't present in new data

This commit is contained in:
Winston Chang
2016-02-09 16:02:13 -06:00
parent 6ab65e2031
commit 189f9589d4

View File

@@ -82,6 +82,17 @@ $.extend(imageOutputBinding, {
img.setAttribute(key, value);
});
// Unset any attributes in the current img that were not provided in the
// new data.
for (var i=0; i<img.attributes.length; i++) {
var attrib = img.attributes[i];
// Need to check attrib.specified on IE because img.attributes contains
// all possible attributes on IE.
if (attrib.specified && !data.hasOwnProperty(attrib.name)) {
img.removeAttribute(attrib.name);
}
}
if (!opts.coordmap)
opts.coordmap = [];