mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-14 22:39:32 +08:00
feat(jqLite): support data() getter and data(obj) setter
... just like jquery does
This commit is contained in:
@@ -215,7 +215,21 @@ function JQLiteData(element, key, value) {
|
||||
}
|
||||
cache[key] = value;
|
||||
} else {
|
||||
return cache ? cache[key] : null;
|
||||
if (isDefined(key)) {
|
||||
if (isObject(key)) {
|
||||
if (!cacheId) element[jqName] = cacheId = jqNextId();
|
||||
jqCache[cacheId] = cache = (jqCache[cacheId] || {});
|
||||
extend(cache, key);
|
||||
} else {
|
||||
return cache ? cache[key] : undefined;
|
||||
}
|
||||
} else {
|
||||
if (!cacheId) element[jqName] = cacheId = jqNextId();
|
||||
|
||||
return cache
|
||||
? cache
|
||||
: cache = jqCache[cacheId] = {};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user