From 0084cb5ca4bc9acda54d304147b0b0fe8e1980f3 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 10 Mar 2011 14:46:07 -0800 Subject: Remove the script tag after successful JSONP request --- CHANGELOG.md | 1 + src/Browser.js | 9 ++++----- test/BrowserSpecs.js | 8 ++++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e6b2c43..223aac97 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Bug Fixes - Fixed cookies which contained unescaped '=' would not show up in cookie service. - Consider all 2xx responses as OK, not just 200 +- Remove the script tag after successful JSONP request ### Breaking changes - Changed the $browser.xhr parameter post from optional to required. Since everyone should be diff --git a/src/Browser.js b/src/Browser.js index abafb2a5..e51df16c 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -91,13 +91,12 @@ function Browser(window, document, body, XHR, $log) { self.xhr = function(method, url, post, callback, headers) { outstandingRequestCount ++; if (lowercase(method) == 'json') { - var callbackId = "angular_" + Math.random() + '_' + (idCounter++); - callbackId = callbackId.replace(/\d\./, ''); - var script = document[0].createElement('script'); - script.type = 'text/javascript'; - script.src = url.replace('JSON_CALLBACK', callbackId); + var callbackId = ("angular_" + Math.random() + '_' + (idCounter++)).replace(/\d\./, ''); + var script = jqLite('