File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -633,11 +633,16 @@ AsProperty.prototype.emit = function(context, target) {
633
633
this . addListeners ( target , node , this . lastSegment ) ;
634
634
} ;
635
635
AsProperty . prototype . addListeners = function ( target , object , key ) {
636
- var deleteProperty = function ( ) {
637
- delete object [ key ] ;
638
- }
639
636
this . addDestroyListener ( target , function asPropertyDestroy ( ) {
640
- process . nextTick ( deleteProperty ) ;
637
+ // memoize initial reference so we dont destroy
638
+ // property that has been replaced with a different reference
639
+ var intialRef = object [ key ] ;
640
+ process . nextTick ( function deleteProperty ( ) {
641
+ if ( intialRef !== object [ key ] ) {
642
+ return ;
643
+ }
644
+ delete object [ key ] ;
645
+ } ) ;
641
646
} ) ;
642
647
} ;
643
648
AsProperty . prototype . addDestroyListener = elementAddDestroyListener ;
You can’t perform that action at this time.
0 commit comments