From: Anna Sobiepanek Date: Thu, 24 Feb 2011 19:44:23 +0000 (-0500) Subject: Merge commit 'rick/347a' into 0.4a X-Git-Tag: v0.4~34 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=d0649db062a5f512cc2104c9dc46bf1b2d16f71a;p=popcorn-js.git Merge commit 'rick/347a' into 0.4a Conflicts: popcorn.js --- d0649db062a5f512cc2104c9dc46bf1b2d16f71a diff --cc .gitignore index 272f498,5147741..190e0d7 --- a/.gitignore +++ b/.gitignore @@@ -1,4 -1,5 +1,4 @@@ dist *~ \.\#* --\#*\# -test/index.html ++\#*\# diff --cc popcorn.js index 861e516,75056db..75e3b04 --- a/popcorn.js +++ b/popcorn.js @@@ -963,15 -980,16 +963,14 @@@ return; } } - - + var head = document.getElementsByTagName("head")[0] || document.documentElement, - script = document.createElement("script"), - paramStr = url.split("?")[1], - fired = false, - params = [], - callback; - + script = document.createElement("script"), + paramStr = url.split("?")[1], + fired = false, + params = [], + callback, parts, callparam; - if ( paramStr && !isScript ) { params = paramStr.split("&"); } @@@ -981,11 -1003,17 +984,17 @@@ if ( !paramStr && !isScript ) { url += "?callback=" + callback; } - + - script.src = url; - if ( callback && !isScript ) { - // define the jsonp success callback globally + + // If a callback name already exists... + if ( !!window[ callback ] ) { + + // Create a new unique callback name + callback = Popcorn.guid( callback ); + } + + // Define the jsonp success callback globally window[ callback ] = function ( data ) { success && success( data ); diff --cc test/popcorn.unit.js index 4595a5a,49b4d07..85ea387 mode 100755,100644..100755 --- a/test/popcorn.unit.js +++ b/test/popcorn.unit.js