More comment text reading for filter optimizations.
This commit is contained in:
parent
d3c4ec3671
commit
b843f78325
@ -639,18 +639,13 @@
|
|||||||
return sub.textContent;
|
return sub.textContent;
|
||||||
},
|
},
|
||||||
comment: function(root) {
|
comment: function(root) {
|
||||||
var i, len, node, nodes, text;
|
var data, i, len, nodes, text;
|
||||||
text = [];
|
text = [];
|
||||||
nodes = d.evaluate('.//node()', root.lastChild, null, 7, null);
|
nodes = d.evaluate('.//br|.//text()', root.lastChild, null, 7, null);
|
||||||
i = 0;
|
i = 0;
|
||||||
len = nodes.snapshotLength;
|
len = nodes.snapshotLength;
|
||||||
while (i < len) {
|
while (i < len) {
|
||||||
node = nodes.snapshotItem(i++);
|
text.push((data = nodes.snapshotItem(i++).data) ? data : '\n');
|
||||||
if (node instanceof Text) {
|
|
||||||
text.push(node.data);
|
|
||||||
} else if (node instanceof HTMLBRElement) {
|
|
||||||
text.push('\n');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return text.join('');
|
return text.join('');
|
||||||
},
|
},
|
||||||
|
|||||||
@ -554,15 +554,11 @@ filter =
|
|||||||
comment: (root) ->
|
comment: (root) ->
|
||||||
text = []
|
text = []
|
||||||
# XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE is 7
|
# XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE is 7
|
||||||
nodes = d.evaluate './/node()', root.lastChild, null, 7, null
|
nodes = d.evaluate './/br|.//text()', root.lastChild, null, 7, null
|
||||||
i = 0
|
i = 0
|
||||||
len = nodes.snapshotLength
|
len = nodes.snapshotLength
|
||||||
while i < len
|
while i < len
|
||||||
node = nodes.snapshotItem i++
|
text.push if data = nodes.snapshotItem(i++).data then data else '\n'
|
||||||
if node instanceof Text
|
|
||||||
text.push node.data
|
|
||||||
else if node instanceof HTMLBRElement
|
|
||||||
text.push '\n'
|
|
||||||
text.join ''
|
text.join ''
|
||||||
filename: (root) ->
|
filename: (root) ->
|
||||||
if file = $ '.filesize > span', root
|
if file = $ '.filesize > span', root
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user