mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
shaved off some more general case complexity of the .toggle(..)/.tags(..) flow...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e58f6d2166
commit
fbbb9a9b13
@ -569,6 +569,7 @@ var BaseTagsPrototype = {
|
|||||||
no_definitions = cmp
|
no_definitions = cmp
|
||||||
cmp = null
|
cmp = null
|
||||||
}
|
}
|
||||||
|
b = b instanceof Set ? [...b] : b
|
||||||
|
|
||||||
// no given tags or multiple tags -> filter...
|
// no given tags or multiple tags -> filter...
|
||||||
if(b == null || b instanceof Array){
|
if(b == null || b instanceof Array){
|
||||||
@ -767,6 +768,7 @@ var BaseTagsPrototype = {
|
|||||||
var seen = new Set()
|
var seen = new Set()
|
||||||
var res = (quoted || root || base
|
var res = (quoted || root || base
|
||||||
|| b instanceof Array
|
|| b instanceof Array
|
||||||
|
|| b instanceof Set
|
||||||
|| typeof(b) == typeof('str')) ?
|
|| typeof(b) == typeof('str')) ?
|
||||||
// b is given and a is an edge -> try a direct match...
|
// b is given and a is an edge -> try a direct match...
|
||||||
this.directMatch(...arguments)
|
this.directMatch(...arguments)
|
||||||
@ -949,9 +951,10 @@ var BaseTagsPrototype = {
|
|||||||
// check if value is tagged by tags..,
|
// check if value is tagged by tags..,
|
||||||
if(value && tags.length > 0){
|
if(value && tags.length > 0){
|
||||||
tags = normalizeSplit(tags)
|
tags = normalizeSplit(tags)
|
||||||
var u = this.tags(value)
|
var u = new Set(this.tags(value))
|
||||||
while(tags.length > 0){
|
while(tags.length > 0){
|
||||||
if(this.match(tags.shift(), u).length == 0){
|
var t = tags.shift()
|
||||||
|
if(!u.has(t) && this.match(t, u).length == 0){
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1158,6 +1161,8 @@ var BaseTagsPrototype = {
|
|||||||
// matching tags values off as expected but ignore toggling
|
// matching tags values off as expected but ignore toggling
|
||||||
// tags on in which case null will be returned for the
|
// tags on in which case null will be returned for the
|
||||||
// corresponding position.
|
// corresponding position.
|
||||||
|
// NOTE: this will set all the tags on if at least one is off
|
||||||
|
// or off if all are on for each item...
|
||||||
//
|
//
|
||||||
// Toggle tag on for all values...
|
// Toggle tag on for all values...
|
||||||
// .toggle(tag, value, 'on')
|
// .toggle(tag, value, 'on')
|
||||||
@ -1213,8 +1218,6 @@ var BaseTagsPrototype = {
|
|||||||
// toggle each...
|
// toggle each...
|
||||||
: values
|
: values
|
||||||
// build the on/off lists...
|
// build the on/off lists...
|
||||||
// XXX this will either set all the tags on (if at least
|
|
||||||
// one is off) or off (if all are on) for each item...
|
|
||||||
.reduce(function(res, v){
|
.reduce(function(res, v){
|
||||||
var state = that.tags(v, tag)
|
var state = that.tags(v, tag)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user