Skip to content

Commit

Permalink
fix object rewrite: don't rewrite for unknown type
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed Aug 13, 2024
1 parent 3b8d78f commit 9fa12f3
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/wombat.js
Original file line number Diff line number Diff line change
Expand Up @@ -2277,19 +2277,21 @@ Wombat.prototype.rewriteElem = function(elem) {
altElemName = 'IMG';
}

var newElem = this.$wbwindow.document.createElement(altElemName);
for (var i = 0; i < elem.attributes.length; i++) {
var attr = elem.attributes[i];
var name = attr.name;
if (name === 'data') {
name = 'src';
if (altElemName) {
var newElem = this.$wbwindow.document.createElement(altElemName);
for (var i = 0; i < elem.attributes.length; i++) {
var attr = elem.attributes[i];
var name = attr.name;
if (name === 'data') {
name = 'src';
}
this.wb_setAttribute.call(newElem, name, attr.value);
}
this.wb_setAttribute.call(newElem, name, attr.value);
}

elem.parentElement.replaceChild(newElem, elem);
changed = true;
break;
elem.parentElement.replaceChild(newElem, elem);
changed = true;
break;
}
}

changed = this.rewriteAttr(elem, 'data', true);
Expand Down

0 comments on commit 9fa12f3

Please sign in to comment.