fix:$browser: Use document.createElement to create JSONP script tag

Creating <script> tags would require a lot of extra work if we want all browsers
to load and execute these scripts. We decided to not implement that in jqLite.

See #369 for more information.

Closes #369
This commit is contained in:
Vojta Jina 2011-06-27 19:01:09 +02:00
parent 8e6e09a4bc
commit 8e915f5545

View file

@ -37,6 +37,7 @@ var XHR_HEADERS = {
*/
function Browser(window, document, body, XHR, $log) {
var self = this,
rawDocument = document[0],
location = window.location,
setTimeout = window.setTimeout;
@ -96,7 +97,7 @@ function Browser(window, document, body, XHR, $log) {
outstandingRequestCount ++;
if (lowercase(method) == 'json') {
var callbackId = ("angular_" + Math.random() + '_' + (idCounter++)).replace(/\d\./, '');
var script = jqLite('<script>')
var script = jqLite(rawDocument.createElement('script'))
.attr({type: 'text/javascript', src: url.replace('JSON_CALLBACK', callbackId)});
window[callbackId] = function(data){
window[callbackId] = undefined;
@ -272,7 +273,6 @@ function Browser(window, document, body, XHR, $log) {
//////////////////////////////////////////////////////////////
// Cookies API
//////////////////////////////////////////////////////////////
var rawDocument = document[0];
var lastCookies = {};
var lastCookieString = '';