]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#140] Merge vvasabi's work
authorstevenaw <sweerdenburg@gmail.com>
Tue, 15 Mar 2011 15:26:01 +0000 (11:26 -0400)
committerstevenaw <sweerdenburg@gmail.com>
Tue, 15 Mar 2011 15:27:12 +0000 (11:27 -0400)
1  2 
popcorn.js
test/popcorn.unit.js

diff --cc popcorn.js
index 24ba6c76e59ba41ac39d951584a4adea0d79f091,88fc775290499e19a84598c2ad3cec83c8483f24..64215bc3dcaa4b701d75c85f6b23686b5bb42965
          return;
        }
  
-       // check if entity is a valid string id
-       matches = rIdExp.exec( entity );
 -
+       if ( (typeof entity) == "string" ) {
+         matches = rIdExp.exec( entity );
  
-       // get video element by id or reference
-       this.video = matches && matches.length && matches[ 2 ] ?
-                     document.getElementById( matches[ 2 ] ) :
-                     entity;
+         if ( matches.length && matches[2]  ) {
+           elem = document.getElementById(matches[2]);
+         }
  
-       Popcorn.addInstance( this );
+         this.video = elem ? elem : null;
+       } else if ( entity instanceof Object ) {
+         this.video = entity;
+       }
  
        this.data = {
          history: [],
Simple merge