mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-23 19:40:56 +08:00
perf(jqLite): expose the low-level jqLite.data/removeData calls
- updated the internal jqLite helpers to use the low-level jqLite.data/removeData to avoid unnecessary jq wrappers and loops - updated $compile to use the low-level jqLite.data/removeData to avoid unnecessary jq wrappers at link time
This commit is contained in:
@@ -386,6 +386,7 @@ describe('jqLite', function() {
|
||||
selected.removeData('prop2');
|
||||
});
|
||||
|
||||
|
||||
it('should add and remove data on SVGs', function() {
|
||||
var svg = jqLite('<svg><rect></rect></svg>');
|
||||
|
||||
@@ -415,6 +416,27 @@ describe('jqLite', function() {
|
||||
});
|
||||
|
||||
|
||||
it('should provide the non-wrapped data calls', function() {
|
||||
var node = document.createElement('div');
|
||||
|
||||
expect(jqLite.data(node, "foo")).toBeUndefined();
|
||||
|
||||
jqLite.data(node, "foo", "bar");
|
||||
|
||||
expect(jqLite.data(node, "foo")).toBe("bar");
|
||||
expect(jqLite(node).data("foo")).toBe("bar");
|
||||
|
||||
expect(jqLite.data(node)).toBe(jqLite(node).data());
|
||||
|
||||
jqLite.removeData(node, "foo");
|
||||
expect(jqLite.data(node, "foo")).toBeUndefined();
|
||||
|
||||
jqLite.data(node, "bar", "baz");
|
||||
jqLite.removeData(node);
|
||||
jqLite.removeData(node);
|
||||
expect(jqLite.data(node, "bar")).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should emit $destroy event if element removed via remove()', function() {
|
||||
var log = '';
|
||||
var element = jqLite(a);
|
||||
|
||||
Reference in New Issue
Block a user