mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	added string path handling for queries...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									abbe36c8c5
								
							
						
					
					
						commit
						4527758a76
					
				| @ -1090,16 +1090,23 @@ var BaseBrowserPrototype = { | |||||||
| 				&& function(elem, i, path){ | 				&& function(elem, i, path){ | ||||||
| 					return pattern.test(elem.value) | 					return pattern.test(elem.value) | ||||||
| 						|| pattern.test('/'+ path.join('/')) } }, | 						|| pattern.test('/'+ path.join('/')) } }, | ||||||
| 		// path test...
 | 		// string path test...
 | ||||||
| 		// NOTE: this does not go down branches that do not match the path...
 |  | ||||||
| 		path: function(pattern){ |  | ||||||
| 			if(pattern instanceof Array || typeof(pattern) == typeof('str')){ |  | ||||||
| 		// XXX should 'B' be equivalent to '/B' or should it be more like '**/B'?
 | 		// XXX should 'B' be equivalent to '/B' or should it be more like '**/B'?
 | ||||||
|  | 		strPath: function(pattern){ | ||||||
|  | 			if(typeof(pattern) == typeof('str')){ | ||||||
| 				pattern = pattern instanceof Array ? | 				pattern = pattern instanceof Array ? | ||||||
| 					pattern | 					pattern | ||||||
| 					: pattern | 					: pattern | ||||||
| 						.split(/[\\\/]/g) | 						.split(/[\\\/]/g) | ||||||
| 						.filter(function(e){ return e.trim().length > 0 }) | 						.filter(function(e){ return e.trim().length > 0 }) | ||||||
|  | 				return this.path(pattern) | ||||||
|  | 			} | ||||||
|  | 			return false | ||||||
|  | 		}, | ||||||
|  | 		// path test...
 | ||||||
|  | 		// NOTE: this does not go down branches that do not match the path...
 | ||||||
|  | 		path: function(pattern){ | ||||||
|  | 			if(pattern instanceof Array){ | ||||||
| 				// XXX add support for '**' ???
 | 				// XXX add support for '**' ???
 | ||||||
| 				var cmp = function(a, b){ | 				var cmp = function(a, b){ | ||||||
| 					return a.length == b.length | 					return a.length == b.length | ||||||
| @ -1214,7 +1221,7 @@ var BaseBrowserPrototype = { | |||||||
| 						&& key == 'query') }) | 						&& key == 'query') }) | ||||||
| 				.reduce(function(res, [_, get]){ | 				.reduce(function(res, [_, get]){ | ||||||
| 					return res  | 					return res  | ||||||
| 						|| get.call(this.__search_test_generators__, pattern) }, false) ) | 						|| get.call(that.__search_test_generators__, pattern) }, false) ) | ||||||
| 
 | 
 | ||||||
| 		return this.walk( | 		return this.walk( | ||||||
| 			function(elem, i, path, next, stop){ | 			function(elem, i, path, next, stop){ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user