diff --git a/4chan_x.user.js b/4chan_x.user.js
index 9b2566f4e..413141f04 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -631,9 +631,20 @@
return sub.textContent;
},
comment: function(root) {
- return ($.el('a', {
- innerHTML: root.lastChild.innerHTML.replace(/
/g, '\n')
- })).textContent;
+ var i, len, node, nodes, text;
+ text = [];
+ nodes = d.evaluate('.//node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
+ i = 0;
+ len = nodes.snapshotLength;
+ while (i < len) {
+ node = nodes.snapshotItem(i++);
+ if (node instanceof Text) {
+ text.push(node.data);
+ } else if (node instanceof HTMLBRElement) {
+ text.push('\n');
+ }
+ }
+ return text.join('');
},
filename: function(root) {
var file;
diff --git a/script.coffee b/script.coffee
index d75e92644..852cdf135 100644
--- a/script.coffee
+++ b/script.coffee
@@ -543,7 +543,17 @@ filter =
sub = if isOP then $ '.filetitle', root else $ '.replytitle', root
sub.textContent
comment: (root) ->
- ($.el 'a', innerHTML: root.lastChild.innerHTML.replace /
/g, '\n').textContent
+ text = []
+ nodes = d.evaluate './/node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
+ i = 0
+ len = nodes.snapshotLength
+ while i < len
+ node = nodes.snapshotItem i++
+ if node instanceof Text
+ text.push node.data
+ else if node instanceof HTMLBRElement
+ text.push '\n'
+ text.join ''
filename: (root) ->
if file = $ '.filesize > span', root
return file.title