Skip to content

Commit

Permalink
Fix regression in <object> tag rewriting (#167)
Browse files Browse the repository at this point in the history
* fix <object> tag rewrite: don't attempt to rewrite for unknown type

* bump to 3.7.13
  • Loading branch information
ikreymer authored Aug 13, 2024
1 parent 3b8d78f commit 6895131
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@webrecorder/wombat",
"version": "3.7.12",
"version": "3.7.13",
"main": "index.js",
"license": "AGPL-3.0-or-later",
"author": "Ilya Kreymer, Webrecorder Software",
Expand Down
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 6895131

Please sign in to comment.