Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 27308e9

Browse files
codelogicmhevery
authored andcommitted
feat(block): Kill block events.
Closes #659
1 parent 6099c03 commit 27308e9

File tree

1 file changed

+3
-44
lines changed

1 file changed

+3
-44
lines changed

lib/core_dom/block.dart

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ abstract class ElementWrapper {
1818
* contain other [Block]s and it is the only way in which DOM can be changed
1919
* structurally.
2020
*
21-
* A [Block] is a collection of DOM nodes and [Directive]s for those nodes.
22-
*
23-
* A [Block] is responsible for instantiating the [Directive]s and for
24-
* inserting / removing itself to/from DOM.
21+
* A [Block] is a collection of DOM nodes
2522
*
2623
* A [Block] can be created from [BlockFactory].
2724
*
@@ -31,11 +28,6 @@ class Block implements ElementWrapper {
3128
ElementWrapper next;
3229
ElementWrapper previous;
3330

34-
Function onInsert;
35-
Function onRemove;
36-
Function onMove;
37-
38-
List<dynamic> _directives = [];
3931
final NgAnimate _animate;
4032

4133
Block(this.elements, this._animate);
@@ -54,49 +46,16 @@ class Block implements ElementWrapper {
5446
dom.Node previousElement = previousElements[previousElements.length - 1];
5547
dom.Node insertBeforeElement = previousElement.nextNode;
5648
dom.Node parentElement = previousElement.parentNode;
57-
bool preventDefault = false;
5849

59-
Function insertDomElements = () {
60-
_animate.insert(elements, parentElement, insertBefore: insertBeforeElement);
61-
};
62-
63-
if (onInsert != null) {
64-
onInsert({
65-
"preventDefault": () {
66-
preventDefault = true;
67-
return insertDomElements;
68-
},
69-
"element": elements[0]
70-
});
71-
}
50+
_animate.insert(elements, parentElement, insertBefore: insertBeforeElement);
7251

73-
if (!preventDefault) {
74-
insertDomElements();
75-
}
7652
return this;
7753
}
7854

7955
Block remove() {
8056
bool preventDefault = false;
8157

82-
Function removeDomElements = () {
83-
_animate.remove(elements);
84-
};
85-
86-
if (onRemove != null) {
87-
onRemove({
88-
"preventDefault": () {
89-
preventDefault = true;
90-
removeDomElements();
91-
return this;
92-
},
93-
"element": elements[0]
94-
});
95-
}
96-
97-
if (!preventDefault) {
98-
removeDomElements();
99-
}
58+
_animate.remove(elements);
10059

10160
// Remove block from list
10261
if (previous != null && (previous.next = next) != null) {

0 commit comments

Comments
 (0)