From: stevenaw Date: Tue, 15 Mar 2011 15:26:01 +0000 (-0400) Subject: [#140] Merge vvasabi's work X-Git-Tag: v0.4~7^2~7 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=a8a3dc22880fe7e3578c1bd47e209b4b30f87120;p=popcorn-js.git [#140] Merge vvasabi's work --- a8a3dc22880fe7e3578c1bd47e209b4b30f87120 diff --cc popcorn.js index 24ba6c7,88fc775..64215bc --- a/popcorn.js +++ b/popcorn.js @@@ -128,15 -75,20 +128,17 @@@ 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: [],