Bug 784386 - Part 2: Replace innerHTML call for <font> to <span> conversion. r=lucasr

This commit is contained in:
Brian Nicholson 2012-08-31 15:56:13 -07:00
parent b4de1179b8
commit f41e02d9b9

View File

@ -216,7 +216,10 @@ Readability.prototype = {
this._replaceBrs(doc.body);
doc.body.innerHTML = doc.body.innerHTML.replace(this.REGEXPS.replaceFonts, '<$1span>');
let fonts = doc.getElementsByTagName("FONT");
for (let i = fonts.length; --i >=0;) {
this._setNodeTag(fonts[i], "SPAN");
}
},
/**
@ -290,6 +293,11 @@ Readability.prototype = {
}
},
_setNodeTag: function (node, tag) {
node.localName = tag.toLowerCase();
node.tagName = tag.toUpperCase();
},
/**
* Prepare the article node for display. Clean out any inline styles,
* iframes, forms, strip extraneous <p> tags, etc.