diff --git a/src/events/helpers/get_events_cache.ts b/src/events/helpers/get_events_cache.ts index 36899e5..e74ec8f 100644 --- a/src/events/helpers/get_events_cache.ts +++ b/src/events/helpers/get_events_cache.ts @@ -2,7 +2,7 @@ // @require ./variables.ts function getEventsCache ( ele: EleLoose ): { [event: string]: [string[], string, EventCallback][] } { - - return ele[eventsNamespace] = ( ele[eventsNamespace] || {} ); - + let cache = eventsWeakMapCache.get( ele ); + if ( !cache ) eventsWeakMapCache.set( ele, cache = {} ); + return cache; } diff --git a/src/events/helpers/variables.ts b/src/events/helpers/variables.ts index 007d0e1..e5581dc 100644 --- a/src/events/helpers/variables.ts +++ b/src/events/helpers/variables.ts @@ -1,5 +1,5 @@ -const eventsNamespace = '___ce'; +const eventsWeakMapCache = new WeakMap (); const eventsNamespacesSeparator = '.'; const eventsFocus: { [event: string]: string | undefined } = { focus: 'focusin', blur: 'focusout' }; const eventsHover: { [event: string]: string | undefined } = { mouseenter: 'mouseover', mouseleave: 'mouseout' }; diff --git a/tsconfig.json b/tsconfig.json index fdca279..f904563 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "lib": ["ES2015.Collection"], "forceConsistentCasingInFileNames": true, "noUnusedParameters": false, "strictNullChecks": false