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