* Create key-value caches of limited size * @returns {Function(string, Object)} Returns the Object data after storing it on itself with * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) * deleting the oldest entry
()
| 299 | */ |
| 300 | |
| 301 | function createCache() { |
| 302 | var keys = []; |
| 303 | |
| 304 | function cache(key, value) { |
| 305 | // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) |
| 306 | if (keys.push(key += " ") > Expr.cacheLength) { |
| 307 | // Only keep the most recent entries |
| 308 | delete cache[keys.shift()]; |
| 309 | } |
| 310 | return (cache[key] = value); |
| 311 | } |
| 312 | return cache; |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * Mark a function for special use by Sizzle |