File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 894
894
// for bulk removal of event listeners. We use them rather than recurse
895
895
// back into `stopObserving` to avoid touching the registry more often than
896
896
// necessary.
897
-
897
+
898
898
// Stop observing _all_ listeners on an element.
899
899
function stopObservingElement ( element ) {
900
- var uid = getUniqueElementID ( element ) ,
901
- registry = getRegistryForElement ( element , uid ) ;
902
-
900
+ // Do a manual registry lookup because we don't want to create a registry
901
+ // if one doesn't exist.
902
+ var uid = getUniqueElementID ( element ) , registry = GLOBAL . Event . cache [ uid ] ;
903
+ // This way we can return early if there is no registry.
904
+ if ( ! registry ) return ;
905
+
903
906
destroyRegistryForElement ( element , uid ) ;
904
-
907
+
905
908
var entries , i ;
906
909
for ( var eventName in registry ) {
907
910
// Explicitly skip elements so we don't accidentally find one with a
You can’t perform that action at this time.
0 commit comments