| 834 | } |
| 835 | |
| 836 | function createLocalCacheLookup() { |
| 837 | var cache = Object.create(null); |
| 838 | return { |
| 839 | flush: function() { |
| 840 | cache = Object.create(null); |
| 841 | }, |
| 842 | |
| 843 | count: function(key) { |
| 844 | var entry = cache[key]; |
| 845 | return entry ? entry.total : 0; |
| 846 | }, |
| 847 | |
| 848 | get: function(key) { |
| 849 | var entry = cache[key]; |
| 850 | return entry && entry.value; |
| 851 | }, |
| 852 | |
| 853 | put: function(key, value) { |
| 854 | if (!cache[key]) { |
| 855 | cache[key] = { total: 1, value: value }; |
| 856 | } else { |
| 857 | cache[key].total++; |
| 858 | } |
| 859 | } |
| 860 | }; |
| 861 | } |
| 862 | |
| 863 | // we do not reassign an already present style value since |
| 864 | // if we detect the style property value again we may be |