From 7580600823142483877cb5ae24085291f4138bb1 Mon Sep 17 00:00:00 2001 From: David Seifried Date: Fri, 26 Aug 2011 14:47:31 -0400 Subject: [PATCH] Created some variables to store a refence to a DOM object that was being called numerous times --- plugins/googlemap/popcorn.googlemap.js | 5 ++++- plugins/wordriver/popcorn.wordriver.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/googlemap/popcorn.googlemap.js b/plugins/googlemap/popcorn.googlemap.js index 725bbb6..a97901c 100755 --- a/plugins/googlemap/popcorn.googlemap.js +++ b/plugins/googlemap/popcorn.googlemap.js @@ -321,8 +321,11 @@ var googleCallback; } }, _teardown: function (options) { + + var target = document.getElementById(options.target); + // the map must be manually removed - document.getElementById(options.target) && document.getElementById(options.target).removeChild(newdiv); + target && target.removeChild(newdiv); newdiv = map = location = null; } }; diff --git a/plugins/wordriver/popcorn.wordriver.js b/plugins/wordriver/popcorn.wordriver.js index 173329f..e727c73 100755 --- a/plugins/wordriver/popcorn.wordriver.js +++ b/plugins/wordriver/popcorn.wordriver.js @@ -133,13 +133,14 @@ }, _teardown: function( options ) { + var target = document.getElementById( options.target ); // removes word span from generated container options.word.parentNode && options._container.removeChild( options.word ); // if no more word spans exist in container, remove container container[ options.target ] && !container[ options.target ].childElementCount && - document.getElementById( options.target ) && document.getElementById( options.target ).removeChild( container[ options.target ] ) && + target && target.removeChild( container[ options.target ] ) && delete container[ options.target ]; } }); -- 2.43.0