* 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
()
| 946 | * deleting the oldest entry |
| 947 | */ |
| 948 | function createCache() { |
| 949 | var keys = []; |
| 950 | |
| 951 | function cache( key, value ) { |
| 952 | |
| 953 | // Use (key + " ") to avoid collision with native prototype properties |
| 954 | // (see https://github.com/jquery/sizzle/issues/157) |
| 955 | if ( keys.push( key + " " ) > Expr.cacheLength ) { |
| 956 | |
| 957 | // Only keep the most recent entries |
| 958 | delete cache[ keys.shift() ]; |
| 959 | } |
| 960 | return ( cache[ key + " " ] = value ); |
| 961 | } |
| 962 | return cache; |
| 963 | } |
| 964 | |
| 965 | /** |
| 966 | * Mark a function for special use by jQuery selector module |