Global xpaths optimization. This is actually faster.
This commit is contained in:
parent
7f26ab50ad
commit
d3c4ec3671
@ -392,7 +392,7 @@
|
||||
},
|
||||
x: function(path, root) {
|
||||
if (root == null) root = d.body;
|
||||
return d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).singleNodeValue;
|
||||
return d.evaluate(path, root, null, 8, null).singleNodeValue;
|
||||
},
|
||||
replace: function(root, el) {
|
||||
return root.parentNode.replaceChild(el, root);
|
||||
@ -641,7 +641,7 @@
|
||||
comment: function(root) {
|
||||
var i, len, node, nodes, text;
|
||||
text = [];
|
||||
nodes = d.evaluate('.//node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
|
||||
nodes = d.evaluate('.//node()', root.lastChild, null, 7, null);
|
||||
i = 0;
|
||||
len = nodes.snapshotLength;
|
||||
while (i < len) {
|
||||
|
||||
@ -301,7 +301,8 @@ $.extend $,
|
||||
$.add d.head, style
|
||||
style
|
||||
x: (path, root=d.body) ->
|
||||
d.evaluate(path, root, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null).
|
||||
# XPathResult.ANY_UNORDERED_NODE_TYPE is 8
|
||||
d.evaluate(path, root, null, 8, null).
|
||||
singleNodeValue
|
||||
replace: (root, el) ->
|
||||
root.parentNode.replaceChild el, root
|
||||
@ -552,7 +553,8 @@ filter =
|
||||
sub.textContent
|
||||
comment: (root) ->
|
||||
text = []
|
||||
nodes = d.evaluate './/node()', root.lastChild, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null
|
||||
# XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE is 7
|
||||
nodes = d.evaluate './/node()', root.lastChild, null, 7, null
|
||||
i = 0
|
||||
len = nodes.snapshotLength
|
||||
while i < len
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user