From: David Seifried Date: Fri, 26 Aug 2011 18:47:31 +0000 (-0400) Subject: Created some variables to store a refence to a DOM object that was being called numer... X-Git-Tag: v0.8^2~7^2 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=7580600823142483877cb5ae24085291f4138bb1;p=popcorn-js.git Created some variables to store a refence to a DOM object that was being called numerous times --- 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 ]; } });