* Element.retrieve(@element, key[, defaultValue]) -> ? * * Retrieves custom metadata set on `element` with [[Element.store]]. * * If the value is `undefined` and `defaultValue` is given, it will be * stored on the element as its new value for that key, then returned.
(element, key, defaultValue)
| 3156 | * stored on the element as its new value for that key, then returned. |
| 3157 | **/ |
| 3158 | function retrieve(element, key, defaultValue) { |
| 3159 | if (!(element = $(element))) return; |
| 3160 | var storage = getStorage(element), value = storage.get(key); |
| 3161 | |
| 3162 | if (Object.isUndefined(value)) { |
| 3163 | storage.set(key, defaultValue); |
| 3164 | value = defaultValue; |
| 3165 | } |
| 3166 | |
| 3167 | return value; |
| 3168 | } |
| 3169 | |
| 3170 | |
| 3171 | Object.extend(methods, { |
nothing calls this directly
no test coverage detected