Explorar o código

Merge pull request #18948 from donmccurdy/cleanup-eventdispatcher-defensive

EventDispatcher: Add comment about defensive copy in dispatchEvent.
Mr.doob %!s(int64=5) %!d(string=hai) anos
pai
achega
e42922ad88
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      src/core/EventDispatcher.js

+ 1 - 0
src/core/EventDispatcher.js

@@ -68,6 +68,7 @@ Object.assign( EventDispatcher.prototype, {
 
 			event.target = this;
 
+			// Make a copy, in case listeners are removed while iterating.
 			var array = listenerArray.slice( 0 );
 
 			for ( var i = 0, l = array.length; i < l; i ++ ) {