javascript - Bootstrap modal not showing in IE11 unless dev tools are open -


i have single page application created durandal.js , i'm having heck of time debugging issue ie11 , durandal's app.showmessage(...) , app.showdialog(...) methods. app runs fine in chrome, firefox , ie 9 , 10, in ie11 running issue app hangs when trying call dialog via app.showdialog(...). if open dev tools before going app runs fine. if try go app, run code results in app.showdialog firing , open dev tools , try run same code access error occurring, it's not helpful. actual error reads script5007: unable property 'name' of undefined or null reference , it's @ file: system.js, line: 90, column: 13. code area of system.js relates durandal's logerror method looks this:

var logerror = function(error) {     if(error instanceof error){         throw error;     }     throw new error(error); }; 

the error stack appears included in attached image (located @ bottom of question). sorry had use alert full error stack since otherwise logged version cutoff.

i have tried few things including ensuring doctype correctly decalred <!doctype html> @ top of index.html file, have added <meta http-equiv="x-ua-compatible" content="ie=edge"> index.html , have tried add own console object catch debug code may still in app via following script found here: https://stackoverflow.com/a/12307201/4367226

<script type="text/javascript">     // ie9 fix     if(!window.console) {         alert("there isn't console!");         var console = {             log: function( x ){},             warn: function( x ){},             error: function( err ){                 alert( "error console object:" );                 alert( err );                 alert( err.stack );             },             time: function(){},             timeend: function(){}         };     } </script> 

i've ensured app has "cache buster" (related https://stackoverflow.com/a/25170531/4367226) adding

$.ajaxsetup({cache:false}); 

to app.

i have tried remove fade class modals without success (as suggested here: https://stackoverflow.com/a/25717025/4367226).

further details - app running durandal 2.0.1, twitter bootstrap 2.3.2 , jquery 1.10.2.

any appreciated , let me know if can clarify anything.

update

after further investigation , debugging have been able find offending line of code in bootstrap-modalmanager.js file's init method , jquery related (so added tag question):

init: function (element, options) {         this.$element = $(element);         this.options = $.extend({}, $.fn.modalmanager.defaults, this.$element.data(), typeof options == 'object' && options);         this.stack = [];         this.backdropcount = 0;          if (this.options.resize) {             var resizetimeout,                 = this;              $(window).on('resize.modal', function(){                 resizetimeout && cleartimeout(resizetimeout);                 resizetimeout = settimeout(function(){                     (var = 0; < that.stack.length; i++){                         that.stack[i].isshown && that.stack[i].layout();                     }                 }, 10);             });         }     }, 

in line reads this.options = $.extend({}, $.fn.modalmanager.defaults, this.$element.data(), typeof options == 'object' && options); above this.$element.data() bit seems blowing things up. error coming from, have no idea why work dev tools open, throws error otherwise.

update 2

after continued digging found jquery 1.10.2's jquery.fn.extend function broken. function try iterate on element's attributes , part of code: name = attrs[i].name; allow code try , access name of (sometimes in ie11) null or undefined value - hence error seeing. code has been fixed in jquery 1.11.3 (and references fact ie11 attrs element can null in code), unfortunately upgraded version breaks other things in app, have replaced jquery 1.10.2's jquery.fn.extend function version 1.11.3's function of same name.

error callstack

so after many, many hours of debugging have found cause of issue. it's related jquery 1.10.2's jquery.data function. in function there loop iterates on element's attributes , tries access .name of (sometimes in ie11) null or undefined value.

that bug fixed in jquery 1.11.3's version of jquery.data, unfortunately couldn't use full upgraded version of jquery without breaking other parts of app. instead replaced jquery 1.10.2's jquery.data function updated version jquery 1.11.3.

this not best solution (i rather not have hack core of jquery , have frankenstein code in app), works.

i'm still puzzled why old code worked fine in ie11 dev tools open, fail otherwise. maybe dev tools adds body element's attributes prevented error happening?


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -