Using Visual Studio 2013, I migrated a hybrid Asp.Net Webforms/MVC 3 web application to Asp.Net Webforms/MVC 5.1. As part of the migration I upgraded Jquery from 1.9.1 to 2.1.1, using the NuGet package manager.
When I run the application in the Visual Studio 2013 debugger in Chrome I have no problem.
When I run the application in the Visual Studio 2013 debugger in IE 9 (compatibilty mode is not on) a master page with these two script tags loads first:
<script src="/Scripts/jquery-2.1.1.js" type="text/javascript"></script>
<script src="/Scripts/jquery-ui-1.10.4.js" type="text/javascript"></script>
It fails with this Javascript error:
Unhandled exception at line 3425, column 4 in http://localhost:25378/Scripts/jquery-2.1.1.js
0x800a01b6 - Microsoft JScript runtime error: Object doesn't support property or method 'addEventListener'
I realize that Jquery 2 does not work with IE 8 and below, but I cannot find any documentation noting any issues with IE 9.
The error occurs on line 3425 of jquery-2.1.1.js inside the jQuery.ready.promise function:
document.addEventListener( "DOMContentLoaded", completed, false );
Strangely, when I stop at the error, examine the document object in the debugger and expand the "Methods" node I can see the "addEventListener" method. It is as if Jquery does not have rights to see the method.
I'd very much like to move up to Jquery 2, and from everything I've read Jquery 2 should work with IE9. Any advice on fixing this issue?
<!DOCTYPE html>
? – Overmantel<meta http-equiv="X-UA-Compatible" content="IE=edge">
right after the opening head tag – Overmantel