foosel/Octoprint #841: Can't login using IE
Add computed property "name" to function objects if not provided by the browser, to avoid dropping out of main.js before it is finished. (cherry picked from commit 68215c6)
This commit is contained in:
parent
354e064969
commit
b25443d142
1 changed files with 10 additions and 0 deletions
|
|
@ -57,6 +57,16 @@ $(function() {
|
|||
// the view model map is our basic look up table for dependencies that may be injected into other view models
|
||||
var viewModelMap = {};
|
||||
|
||||
// Fix Function#name on browsers that do not support it (IE):
|
||||
// see: http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie
|
||||
if (!(function f() {}).name) {
|
||||
Object.defineProperty(Function.prototype, 'name', {
|
||||
get: function() {
|
||||
return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// helper to create a view model instance with injected constructor parameters from the view model map
|
||||
var _createViewModelInstance = function(viewModel, viewModelMap){
|
||||
var viewModelClass = viewModel[0];
|
||||
|
|
|
|||
Loading…
Reference in a new issue