]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#734] Removed setOptions function as it was not needed. Fixed destruction of object...
authorMatthew Schranz <schranz.m@gmail.com>
Wed, 28 Sep 2011 16:26:06 +0000 (12:26 -0400)
committerMatthew Schranz <schranz.m@gmail.com>
Wed, 28 Sep 2011 16:26:06 +0000 (12:26 -0400)
plugins/facebook/popcorn.facebook.js
plugins/facebook/popcorn.facebook.unit.js

index 57e2f37ec3afce529b676a5bb90a06eff22085a7..dc36766301a341cd3d1ad6f994d6306657d4a50f 100755 (executable)
 
       // 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.
-      var setOptions = function() {
-        // activity feed uses 'site' rather than 'href'
-        var attr = _type === "activity" ? "site" : "href";
+      // activity feed uses 'site' rather than 'href'
+      var attr = _type === "activity" ? "site" : "href";
 
-        options._container.setAttribute( attr, ( options[ attr ] || document.URL ) );
+      options._container.setAttribute( attr, ( options[ attr ] || document.URL ) );
 
-        // create an array of Facebook widget attributes
-        var fbAttrs = (
-          "width height layout show_faces stream header colorscheme" +
-          " maxrows border_color recommendations font always_post_to_friends xid"
-        ).split(" ");
+      // create an array of Facebook widget attributes
+      var fbAttrs = (
+        "width height layout show_faces stream header colorscheme" +
+        " maxrows border_color recommendations font always_post_to_friends xid"
+      ).split(" ");
 
-        Popcorn.forEach( fbAttrs, function( attr ) {
-          // Test for null/undef. Allows 0, false & ""
-          if ( options[ attr ] != null ) {
-            options._container.setAttribute( attr, options[ attr ] );
-          }
-        });
-      };
-
-      setOptions();
+      Popcorn.forEach( fbAttrs, function( attr ) {
+        // Test for null/undef. Allows 0, false & ""
+        if ( options[ attr ] != null ) {
+          options._container.setAttribute( attr, options[ attr ] );
+        }
+      });
 
       if ( !target && Popcorn.plugin.debug ) {
         throw new Error( "Facebook target container doesn't exist" );
     */
     end: function( event, options ){
       options._container.style.display = "none";
-      options._container.innerHTML = "";
+    },
+    _teardown: function( event, options ){
+      target && target.removeChild( options._container );
     }
   });
 
index 9201ab2b4226be6bb5d158eac1ea8c1577b361b0..00b03c0196563cfbff2effc30d7c6e2a1dd148e1 100755 (executable)
@@ -30,7 +30,7 @@ test( "Popcorn Facebook Plugin", function () {
     end: 6
   })
   .facebook({
-    href: "http://www.facebook.com/senecacollege",
+    href: "https://www.facebook.com/boardwalkempire",
     type: "FACEPILE",
     target: "facepilediv",
     start: 4,