mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-06-25 23:03:15 +00:00
Optimise the tag filter
Spending a bit more time with Chrome dev tools, and further to 254e1ca
, this optimisation reduces the rendering time for the sample TOC from 1.9s to about 0.9s...
This commit is contained in:
parent
7e71fcfab8
commit
e4b10d42f9
|
@ -25,17 +25,18 @@ exports.tag = function(source,operator,options) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Old semantics:
|
// Old semantics:
|
||||||
|
var tiddlers = options.wiki.getTiddlersWithTag(operator.operand);
|
||||||
if(operator.prefix === "!") {
|
if(operator.prefix === "!") {
|
||||||
// Returns a copy of the input if operator.operand is missing
|
// Returns a copy of the input if operator.operand is missing
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(tiddler && !tiddler.hasTag(operator.operand)) {
|
if(tiddlers.indexOf(title) === -1) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Returns empty results if operator.operand is missing
|
// Returns empty results if operator.operand is missing
|
||||||
source(function(tiddler,title) {
|
source(function(tiddler,title) {
|
||||||
if(tiddler && tiddler.hasTag(operator.operand)) {
|
if(tiddlers.indexOf(title) !== -1) {
|
||||||
results.push(title);
|
results.push(title);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user