From: Anna Sobiepanek Date: Thu, 24 Feb 2011 19:24:08 +0000 (-0500) Subject: Merge commit 'rick/347a' into 0.4 X-Git-Tag: v0.4~7^2~12 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=993b9d602b11f133b21ea8a0bf9eabf5fc04b6dc;p=popcorn-js.git Merge commit 'rick/347a' into 0.4 Conflicts: popcorn.js --- 993b9d602b11f133b21ea8a0bf9eabf5fc04b6dc diff --cc popcorn.js index 861e516,75056db..be3da48 --- a/popcorn.js +++ b/popcorn.js @@@ -963,14 -980,15 +963,13 @@@ 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; - ++ 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