|
|
|
@ -538,7 +538,16 @@ Readability.prototype = {
|
|
|
|
|
replacement.readability = node.readability;
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < node.attributes.length; i++) {
|
|
|
|
|
replacement.setAttribute(node.attributes[i].name, node.attributes[i].value);
|
|
|
|
|
try {
|
|
|
|
|
replacement.setAttribute(node.attributes[i].name, node.attributes[i].value);
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
/* it's possible for setAttribute() to throw if the attribute name
|
|
|
|
|
* isn't a valid XML Name. Such attributes can however be parsed from
|
|
|
|
|
* source in HTML docs, see https://github.com/whatwg/html/issues/4275,
|
|
|
|
|
* so we can hit them here and then throw. We don't care about such
|
|
|
|
|
* attributes so we ignore them.
|
|
|
|
|
*/
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return replacement;
|
|
|
|
|
},
|
|
|
|
|