mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-09 15:24:43 +00:00
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:
parent
8e6e09a4bc
commit
8e915f5545
1 changed files with 2 additions and 2 deletions
|
|
@ -37,6 +37,7 @@ var XHR_HEADERS = {
|
||||||
*/
|
*/
|
||||||
function Browser(window, document, body, XHR, $log) {
|
function Browser(window, document, body, XHR, $log) {
|
||||||
var self = this,
|
var self = this,
|
||||||
|
rawDocument = document[0],
|
||||||
location = window.location,
|
location = window.location,
|
||||||
setTimeout = window.setTimeout;
|
setTimeout = window.setTimeout;
|
||||||
|
|
||||||
|
|
@ -96,7 +97,7 @@ function Browser(window, document, body, XHR, $log) {
|
||||||
outstandingRequestCount ++;
|
outstandingRequestCount ++;
|
||||||
if (lowercase(method) == 'json') {
|
if (lowercase(method) == 'json') {
|
||||||
var callbackId = ("angular_" + Math.random() + '_' + (idCounter++)).replace(/\d\./, '');
|
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)});
|
.attr({type: 'text/javascript', src: url.replace('JSON_CALLBACK', callbackId)});
|
||||||
window[callbackId] = function(data){
|
window[callbackId] = function(data){
|
||||||
window[callbackId] = undefined;
|
window[callbackId] = undefined;
|
||||||
|
|
@ -272,7 +273,6 @@ function Browser(window, document, body, XHR, $log) {
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
// Cookies API
|
// Cookies API
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
var rawDocument = document[0];
|
|
||||||
var lastCookies = {};
|
var lastCookies = {};
|
||||||
var lastCookieString = '';
|
var lastCookieString = '';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue