| 815 | } |
| 816 | |
| 817 | function createLocalCacheLookup() { |
| 818 | var cache = Object.create(null); |
| 819 | return { |
| 820 | flush: function() { |
| 821 | cache = Object.create(null); |
| 822 | }, |
| 823 | |
| 824 | count: function(key) { |
| 825 | var entry = cache[key]; |
| 826 | return entry ? entry.total : 0; |
| 827 | }, |
| 828 | |
| 829 | get: function(key) { |
| 830 | var entry = cache[key]; |
| 831 | return entry && entry.value; |
| 832 | }, |
| 833 | |
| 834 | put: function(key, value) { |
| 835 | if (!cache[key]) { |
| 836 | cache[key] = { total: 1, value: value }; |
| 837 | } else { |
| 838 | cache[key].total++; |
| 839 | } |
| 840 | } |
| 841 | }; |
| 842 | } |
| 843 | |
| 844 | // we do not reassign an already present style value since |
| 845 | // if we detect the style property value again we may be |