From 3fcc9579d0eeb3128bc022bf4183c437bc19bbae Mon Sep 17 00:00:00 2001 From: Matthew Schranz Date: Wed, 28 Sep 2011 17:02:14 -0400 Subject: [PATCH] More trying to fix tests --- plugins/facebook/popcorn.facebook.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/plugins/facebook/popcorn.facebook.js b/plugins/facebook/popcorn.facebook.js index 55256ce..0ae26b9 100755 --- a/plugins/facebook/popcorn.facebook.js +++ b/plugins/facebook/popcorn.facebook.js @@ -212,17 +212,17 @@ } - options.container = document.createElement( "div" ); - options.container.id = "facebookdiv-" + Popcorn.guid(); - facebookdiv = document.createElement( "fb:" + _type ); - options.container.appendChild( facebookdiv ); + options._container = document.createElement( "div" ); + options._container.id = "facebookdiv-" + Popcorn.guid(); + options._facebookdiv = document.createElement( "fb:" + _type ); + options._container.appendChild( options._facebookdiv ); // All the the "types" for facebook share largely identical attributes, for loop suffices. // ** Credit to Rick Waldron, it's essentially all his code in this function. // activity feed uses 'site' rather than 'href' var attr = _type === "activity" ? "site" : "href"; - facebookdiv.setAttribute( attr, ( options[ attr ] || document.URL ) ); + options._facebookdiv.setAttribute( attr, ( options[ attr ] || document.URL ) ); // create an array of Facebook widget attributes var fbAttrs = ( @@ -233,14 +233,14 @@ Popcorn.forEach( fbAttrs, function( attr ) { // Test for null/undef. Allows 0, false & "" if ( options[ attr ] != null ) { - facebookdiv.setAttribute( attr, options[ attr ] ); + options._facebookdiv.setAttribute( attr, options[ attr ] ); } }); if ( !target && Popcorn.plugin.debug ) { throw new Error( "Facebook target container doesn't exist" ); } - target && target.appendChild( options.container ); + target && target.appendChild( options._container ); }, /** * @member facebook @@ -249,7 +249,7 @@ * options variable */ start: function( event, options ){ - options.container.style.display = ""; + options._container.style.display = ""; }, /** * @member facebook @@ -258,10 +258,11 @@ * options variable */ end: function( event, options ){ - options.container.style.display = "none"; + options._container.style.display = "none"; }, - _teardown: function( event, options ){ - target && target.removeChild( facebookdiv ); + _teardown: function( options ){ + var target = document.getElementById( options.target ); + target && target.removeChild( options._facebookdiv ); } }); -- 2.43.0