@@ -79,12 +79,21 @@ exports._initDOMHooks = function () {
79
79
80
80
function onAttached ( ) {
81
81
this . _isAttached = true
82
- var children = this . _children
83
- for ( var i = 0 , l = children . length ; i < l ; i ++ ) {
84
- var child = children [ i ]
85
- if ( ! child . _isAttached && inDoc ( child . $el ) ) {
86
- child . _callHook ( 'attached' )
87
- }
82
+ this . _children . forEach ( callAttach )
83
+ if ( this . _transCpnts ) {
84
+ this . _transCpnts . forEach ( callAttach )
85
+ }
86
+ }
87
+
88
+ /**
89
+ * Iterator to call attached hook
90
+ *
91
+ * @param {Vue } child
92
+ */
93
+
94
+ function callAttach ( child ) {
95
+ if ( ! child . _isAttached && inDoc ( child . $el ) ) {
96
+ child . _callHook ( 'attached' )
88
97
}
89
98
}
90
99
@@ -94,12 +103,21 @@ function onAttached () {
94
103
95
104
function onDetached ( ) {
96
105
this . _isAttached = false
97
- var children = this . _children
98
- for ( var i = 0 , l = children . length ; i < l ; i ++ ) {
99
- var child = children [ i ]
100
- if ( child . _isAttached && ! inDoc ( child . $el ) ) {
101
- child . _callHook ( 'detached' )
102
- }
106
+ this . _children . forEach ( callDetach )
107
+ if ( this . _transCpnts ) {
108
+ this . _transCpnts . forEach ( callDetach )
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Iterator to call detached hook
114
+ *
115
+ * @param {Vue } child
116
+ */
117
+
118
+ function callDetach ( child ) {
119
+ if ( child . _isAttached && ! inDoc ( child . $el ) ) {
120
+ child . _callHook ( 'detached' )
103
121
}
104
122
}
105
123
0 commit comments