Avoid nested function declarations

Not supported in older browsers, e.g. iOS 9.
This commit is contained in:
Pierre Ossman 2017-06-02 14:44:20 +02:00
parent 255fbe0c9e
commit 493ad1a24b
3 changed files with 13 additions and 13 deletions

View File

@ -1169,7 +1169,7 @@ var loader;
// <script type="module"> support
var anonSources = {};
if (typeof document != 'undefined' && document.getElementsByTagName) {
function handleError(err) {
var handleError = function(err) {
// dispatch an error event so that we can display in errors in browsers
// that don't yet support unhandledrejection
if (window.onunhandledrejection === undefined) {
@ -1195,9 +1195,9 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
// throw so it still shows up in the console
throw err;
}
};
function ready() {
var ready = function() {
document.removeEventListener('DOMContentLoaded', ready, false );
var anonCnt = 0;
@ -1223,7 +1223,7 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
}
}
}
}
};
// simple DOM ready
if (document.readyState === 'complete')
@ -1263,12 +1263,12 @@ BrowserESModuleLoader.prototype[RegisterLoader$1.resolve] = function(key, parent
function xhrFetch(url, resolve, reject) {
var xhr = new XMLHttpRequest();
function load(source) {
var load = function(source) {
resolve(xhr.responseText);
}
function error() {
};
var error = function() {
reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
}
};
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) {

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ var loader;
// <script type="module"> support
var anonSources = {};
if (typeof document != 'undefined' && document.getElementsByTagName) {
function handleError(err) {
var handleError = function(err) {
// dispatch an error event so that we can display in errors in browsers
// that don't yet support unhandledrejection
if (window.onunhandledrejection === undefined) {
@ -37,7 +37,7 @@ if (typeof document != 'undefined' && document.getElementsByTagName) {
throw err;
}
function ready() {
var ready = function() {
document.removeEventListener('DOMContentLoaded', ready, false );
var anonCnt = 0;
@ -103,10 +103,10 @@ BrowserESModuleLoader.prototype[RegisterLoader.resolve] = function(key, parent)
function xhrFetch(url, resolve, reject) {
var xhr = new XMLHttpRequest();
function load(source) {
var load = function(source) {
resolve(xhr.responseText);
}
function error() {
var error = function() {
reject(new Error('XHR error' + (xhr.status ? ' (' + xhr.status + (xhr.statusText ? ' ' + xhr.statusText : '') + ')' : '') + ' loading ' + url));
}