title: Jquery syntax error only in IE 11
body: <p>I have a main page that load another html page with some javascript inside.
  Unfortunately, in IE 11 the debugger retrieve me a syntax error in jquery.2.1.0.min.js. The javascript isn't executed at all.
  With all other browsers the problem doesn't exist. I've checked the script with javascript lint, but there aren't significant error.</p>
  
  <p>If you want the online test:
  <a href="http://www.twisteggup.com" rel="nofollow">TwisteggUp</a>, than click on "What" menu and than click on "Web" span.</p>
  
  <pre><code> //dichiarazioni globali
  var servUrl;
  var $currGallery;
  var currPortrait;
  var currTabIndex;
  //switch iniziale
  if ($('#pageType').attr('value') == 'web') {
      servUrl = "/EggWS.asmx/GetWebProjects";
  }
  else {
      servUrl = "/EggWS.asmx/GetGraphicProjects";
  }
  //richiesta Ajax
  SwitchAjaxBrowser(servUrl);
  //funzioni per richieste Ajax
  function SwitchAjaxBrowser(servUrl) {
      $.ajax({
          url: servUrl,
          dataType: "xml",
          success: function (xml) { ProcessAjaxRequest(xml); },
          error: function (xhr, status, error) {
              console.log(xhr.status);
          }
      });
  }
  function ProcessAjaxRequest(xml) {
      //crea oggetti progetto
      console.log(xml);
      var i = 0;
      var pjCount = $(xml).find('Project').length;
      $(xml).find('Project').each(function () {
          var pjObject = $('#pj' + i);
          console.log($(this).find('Name').text());
          pjObject.children('.pjContent').children('.pjName').html($(this).find('Name').text());
          pjObject.children('.pjContent').children('.pjDesc').load($(this).find('Description').text());
          pjObject.children('.pjContent').children('.pjFullDesc').html($(this).find('FullDescription').text());
          pjObject.children('.pjContent').children('.pjSkills').html($(this).find('Skills').text());
          //popolo le info e la galleria nascosta
          pjObject.children('.pjContent').children('.pjmImage').attr('src', $(this).find('MainImage').text());
          //archivio i dati con le info delle immagini
          $(this).find('ProjectImage').each(function () {
              pjObject.children('.pjContent').children('.pjmImage').clone(false).attr('src', $(this).text()).removeClass('pjmImage').addClass('pjmDetailImageGallery').appendTo(pjObject.children('.pjContent').children('.pjGallery'));
          });
          //se è il terzo oggetto
          if ((i &gt; 0) &amp;&amp; ((i + 1) % 3 == 0) &amp;&amp; (i &lt; (pjCount - 1))) {
              pjObject.parent().clone().empty().insertAfter(pjObject.parent());
              $('.pjPager').last().data('index', (i + 1) / 3);
              pjObject.clone().attr('id', 'pj' + (i + 1)).appendTo($('.pjPager').last()).children('.pjContent').children('.pjGallery').html('');
          } else
              //se non è l'ultimo, clona l'oggetto
              if (i &lt; (pjCount - 1)) {
                  pjObject.clone().attr('id', 'pj' + (i + 1)).insertAfter(pjObject).children('.pjContent').children('.pjGallery').html('');
              }
          i++;
      });
      $('.pjLoad').fadeOut(500);
      $('#pjGeneralContainer').children('.pjPager').fadeIn(500);
      //correla l'evento di caricamento generale alla visualizzazione.
      //$('#pjGeneralContainer').waitForImages(function () {
  
      //});
      //gestione dell'hovering per tutti i progetti
      $('.pjContent').each(function () {
          $(this).children('.pjDesc').mouseover(function (e) {
              $(this).stop().animate({ height: '365px' }, { duration: 600, step: function (now) { $(this).css('height', now + 'px'); } });
          });
      });
      $('.pjContent').each(function () {
          $(this).children('.pjDesc').mouseout(function (e) {
              $(this).stop().animate({ height: '30px' }, { duration: 600, step: function (now) { $(this).css('height', now + 'px'); } });
          });
      });
      //popolamento scheda singolo progetto
      $('.pjContent').on('click', function () {
          PopulateDetailedContainer($(this));
      });
      $('.pjBtn').on('click', function () { moveGallery($(this)); });
      //scomparsa dettaglio progetto
      function CancelDetailedContainer() {
          $('#pjDetailContainer').fadeOut(500);
          $('#pjGeneralContainer').fadeIn(500);
          $('.pjNav').fadeIn(500);
          //svuoto le informazioni
          $('.pjDetailmImage').attr('src', '');
          $('.pjDetailTitle').html('');
          $('.pjDetailFullDesc').html('');
          $('.pjTab3Skill').html('');
          $('.pjDetailGallery').html('');
          //ripristino le condizioni iniziali
          $('.pjDetailTab2').css('height', '100px');
          $('.pjDetailTab3').css('height', '100px');
          $('.pjBtn').removeClass('pjBtnDown');
          $('.pjBtn').removeClass('pjBtnUp');
          $('.pjBtn').addClass('pjBtnUp');
      }
      function PopulateDetailedContainer($projectContent) {
          $currGallery = $projectContent.children('.pjGallery');
          currTabIndex = 0;
          //effetti di transizione
          $('#pjGeneralContainer').fadeOut(500);
          $('.pjNav').fadeOut(500);
          $('#pjDetailContainer').fadeIn(500);
          //popolo le informazioni
          $('.pjDetailmImage').attr('src', $projectContent.children('.pjmImage').attr('src'));
          var cancBtn = "&lt;a class='btnDetailCancel' /&gt;";
          $('.pjDetailTitle').html(cancBtn + $projectContent.children('.pjName').html());
          $('.pjDetailTitle').children('.btnDetailCancel').on('click', function () { CancelDetailedContainer(); });
          $('.pjDetailFullDesc').load($projectContent.children('.pjFullDesc').html());
          $('.pjTab3Skill').load($projectContent.children('.pjSkills').html());
          var sliderBtn = "&lt;a class='sliderLeft'/&gt;&lt;a class='sliderRight'/&gt;";
          $('.pjDetailGallery').html($projectContent.children('.pjGallery').html());
          //controllo orientamento per galleria - inizializzazione owl
          buildGallery();
          $(window).resize(function () { moveGallery(null); });
      }
      function assignGalleryHeight() {
          var wHeight = $('.SiteBody').height();
          var galleryHeight = wHeight - 350;
          var galleryWidth = $('.pjDetailGallery').width();
          switch (currTabIndex) {
              case 0:
                  $('.pjDetailTab2').css('height', '100px');
                  $('.pjDetailTab3').css('height', '100px');
                  break;
              case 1:
                  $('.pjDetailTab2').css('height', (wHeight - 250) + 'px');
                  $('.pjDetailTab3').css('height', '100px');
                  break;
              case 2:
                  $('.pjDetailTab2').css('height', (wHeight - 250) + 'px');
                  $('.pjDetailTab3').css('height', (wHeight - 250) + 'px');
                  break;
          }
          $('.pjmDetailImageGallery').removeAttr('style');
          //se orizzontale una sola immagine, se verticale 2 immagini
          if (localStorage['portrait'] == 'Y') {
              $('.pjmDetailImageGallery').css('max-height', (galleryHeight - 30) + 'px');
              $('.pjmDetailImageGallery').css('max-width', (galleryWidth) + 'px');
              $('.pjmDetailImageGallery').css('margin-top', '0px');
              //eliminazione visualizzazione speciale
              $('.pjDetailmImage').removeAttr('style');
              $('.pjDetailTab1').removeAttr('style');
              $('.pjDetailFullDesc').removeAttr('style');
          }
          else {
              $('.pjmDetailImageGallery').css('max-height', (galleryHeight - 50) / 2 + 'px');
              $('.pjmDetailImageGallery').css('max-width', (galleryWidth) + 'px');
              $('.pjmDetailImageGallery').css('margin-top', '10px');
              //visualizzazione speciale
              $('.pjDetailmImage').css('float', 'none');
              $('.pjDetailmImage').css('height', '600px');
              $('.pjDetailmImage').css('margin-top', '30px');
              $('.pjDetailTab1').css('text-align', 'center');
              $('.pjDetailTab1').css('text-align', 'center');
              $('.pjDetailFullDesc').css('font-size', '150%');
          }
      }
      function buildGallery() {
          //azzeramento di sicurezza delle informazioni
          var $pjDetailGallery = $('.pjDetailGallery');
          $pjDetailGallery.html("");
          if (typeof $pjDetailGallery.data('owlCarousel') != 'undefined') {
              $pjDetailGallery.data('owlCarousel').destroy();
              $pjDetailGallery.removeClass('owl-carousel');
          }
          //resetto i bottoni
          currTabIndex = 0;
          $('.pjTab2Title').children('div').removeClass('pjBtnDown');
          if (!$('.pjTab2Title').children('div').hasClass('pjBtnUp'))
              $('.pjTab2Title').children('div').addClass('pjBtnUp');
          $('.pjTab3Title').children('div').removeClass('pjBtnDown');
          if (!$('.pjTab3Title').children('div').hasClass('pjBtnUp'))
              $('.pjTab3Title').children('div').addClass('pjBtnUp');
          //recupero le info della galleria
          if (localStorage['portrait'] == 'Y') {
              //ricreo gli oggetti come erano
              $('.pjDetailGallery').html($currGallery.html());
          }
          else {
              //ricreo gli oggetti a coppie
              k = 0;
              $currGallery.children().each(function () {
                  if (k % 2 == 0) {
                      $pjDetailGallery.append("&lt;div class='verticalGallery'&gt;&lt;/div&gt;");
                  }
                  $(this).clone().appendTo($pjDetailGallery.children('div').last());
                  k++;
              });
          }
          assignGalleryHeight();
          if (localStorage['portrait'] == 'Y') {
              $pjDetailGallery.owlCarousel({
                  items: 1,
                  itemsCustom: [0, 1],
                  scrollPerPage: true
              });
          }
          else {
              $pjDetailGallery.owlCarousel({
                  items: 1,
                  itemsCustom: [0, 1],
                  scrollPerPage: true
              });
          }
      }
      //gestione movimento tra schede del progetto singolo
      function moveGallery($btn) {
          var wHeight = $('.SiteBody').height();
          //per il resize della finestra
          if ($btn == null) {
              //se è cambiato l'orientamento della pagina ricostruisco tutto
              if (currPortrait != localStorage['portrait']) {
                  buildGallery();
                  currPortrait = localStorage['portrait'];
                  return;
              }
              assignGalleryHeight();
              return;
          }
          //la finestra deve salire
          if ($btn.hasClass('pjBtnUp')) {
              $('.pjDetailGallery').css('height', (wHeight - 350) + 'px');
              switch ($btn.data('index')) {
                  case 1:
                      $('.pjDetailTab2').stop().animate({ height: (wHeight - 250) + 'px' }, { duration: 600, step: function (now) { $(this).css('height', now + 'px'); } });
                      $btn.removeClass('pjBtnUp');
                      $btn.addClass('pjBtnDown');
                      currTabIndex = 1;
                      break;
                  case 2:
                      $('.pjDetailTab2').stop().animate({ height: (wHeight - 250) + 'px' }, { duration: 600, step: function (now) { $(this).css('height', now + 'px'); } });
                      $('.pjDetailTab3').stop().animate({ height: (wHeight - 250) + 'px' }, { duration: 600, step: function (now) { $(this).css('height', now + 'px'); } });
                      $btn.removeClass('pjBtnUp');
                      $btn.addClass('pjBtnDown');
                      $('.pjTab2Title').children('div').removeClass('pjBtnUp');
                      if (!$('.pjTab2Title').children('div').hasClass('pjBtnDown'))
                          $('.pjTab2Title').children('div').addClass('pjBtnDown');
                      currTabIndex = 2;
                      break;
                  default:
                      break;
              }
          }
              //la finestra deve scendere
          else {
              switch ($btn.data('index')) {
                  case 1:
                      $('.pjDetailTab2').stop().animate({ height: '100px' }, { duration: 600, step: function (now) { $(this).css('height', now + 'px'); } });
                      $('.pjDetailTab3').stop().animate({ height: '100px' }, { duration: 600, step: function (now) { $(this).css('height', now + 'px'); } });
                      $btn.removeClass('pjBtnDown');
                      $btn.addClass('pjBtnUp');
                      $('.pjTab3Title').children('div').removeClass('pjBtnDown');
                      if (!$('.pjTab3Title').children('div').hasClass('pjBtnUp'))
                          $('.pjTab3Title').children('div').addClass('pjBtnUp');
                      currTabIndex = 0;
                      break;
                  case 2:
                      $('.pjDetailTab3').stop().animate({ height: '100px' }, { duration: 600, step: function (now) { $(this).css('height', now + 'px'); } });
                      $btn.removeClass('pjBtnDown');
                      $btn.addClass('pjBtnUp');
                      currTabIndex = 1;
                      break;
                  default:
                      break;
              }
          }
          //checkGalleryPortrait();
      }
      //termine controllo caricamento portfolio
      localStorage['folioisloading'] = 'N';
      //Inizializzazione transizioni
      InitiateTransition();
      return false;
  }
  function InitiateTransition() {
      var $main = $('#pjGeneralContainer'),
          $pages = $main.children('div.pt-page'),
          animcursor = 1,
          pagesCount = $pages.length,
          current = 0,
          isAnimating = false,
          endCurrPage = false,
          endNextPage = false,
          animEndEventNames = {
              'WebkitAnimation': 'webkitAnimationEnd',
              'OAnimation': 'oAnimationEnd',
              'msAnimation': 'MSAnimationEnd',
              'animation': 'animationend'
          },
          // animation end event name
          animEndEventName = animEndEventNames[Modernizr.prefixed('animation')],
          // support css animations
          support = Modernizr.cssanimations;
  
      function init() {
  
          $pages.each(function () {
              var $page = $(this);
              $page.data('originalClassList', $page.attr('class'));
          });
  
          $pages.eq(current).addClass('pt-page-current');
          CreateNav();
          responsive();
      }
      function CreateNav() {
          var i = 0;
          //navigazione precedente
          $('.pjNav').append("&lt;a class='pjNavPrev pjNavIcon' /&gt;");
          $('.pjNav').children().last().on('click', function () {
              previousPager();
          });
          //navigazione checkbox
          $main.children('.pjPager').each(function () {
              var $pjPager = $(this);
              $('.pjNav').append("&lt;a class='pjNavButton' data-index='" + $pjPager.data('index') + "' /&gt;");
              if (i == 0)
                  $('.pjNav').children().last().css('margin-left', '0px');
              $('.pjNav').children().last().on('click', function () {
                  goToPager($pjPager.data('index'));
              });
              i++;
          });
          //navigazione successivo
          $('.pjNav').append("&lt;a class='pjNavNext pjNavIcon' /&gt;");
          $('.pjNav').children().last().on('click', function () {
              nextPager();
          });
          $('.pjNavButton').each(function () {
              if ($(this).data('index') == 0)
                  $(this).addClass('pjNavButtonCurrent');
              else
                  $(this).removeClass('pjNavButtonCurrent');
          });
      }
      //funzioni di navigazione
      function goToPager(toPageIndex) {
          if (current == toPageIndex)
              return false;
          if (isAnimating)
              return false;
  
          isAnimating = true;
          var $currPage = $pages.eq(current);
          var $nextPage = $pages.eq(toPageIndex).addClass('pt-page-current');
  
          //seleziono il bottone di navigazione corrente
          $('.pjNavButton').each(function () {
              if ($(this).data('index') == toPageIndex)
                  $(this).addClass('pjNavButtonCurrent');
              else
                  $(this).removeClass('pjNavButtonCurrent');
          });
          //imposto lo stile dell'animazione
          if (current &gt; toPageIndex) {
              outClass = 'pt-page-rotatePushRight';
              inClass = 'pt-page-moveFromLeft';
          }
          else {
              outClass = 'pt-page-rotatePushLeft';
              inClass = 'pt-page-moveFromRight';
          }
  
  
          current = toPageIndex;
  
          $currPage.addClass(outClass).on(animEndEventName, function () {
              $currPage.off(animEndEventName);
              endCurrPage = true;
              if (endNextPage) {
                  onEndAnimation($currPage, $nextPage);
              }
          });
  
          $nextPage.addClass(inClass).on(animEndEventName, function () {
              $nextPage.off(animEndEventName);
              endNextPage = true;
              if (endCurrPage) {
                  onEndAnimation($currPage, $nextPage);
              }
          });
  
          if (!support) {
              onEndAnimation($currPage, $nextPage);
          }
  
      }
      function nextPager() {
  
          if (current &lt; pagesCount - 1) {
              goToPager(current + 1);
          }
  
      }
      function previousPager() {
  
          if (current &gt; 0) {
              goToPager(current - 1);
          }
  
      }
      function onEndAnimation($outpage, $inpage) {
          endCurrPage = false;
          endNextPage = false;
          resetPage($outpage, $inpage);
          isAnimating = false;
          //animazione di transizione completata.-&gt; da inserire qui animazione dei progetti (se la facciamo).
      }
      function resetPage($outpage, $inpage) {
          $outpage.attr('class', $outpage.data('originalClassList'));
          $inpage.attr('class', $inpage.data('originalClassList') + ' pt-page-current');
      }
      //funzione per lo scroll
      function responsive() {
  
          $(document).bind("swipeRight", function (event) {
              event.preventDefault();
              nextPager();
          }).bind("swipeLeft", function (event) {
              event.preventDefault();
              previousPager();
          });
  
          $(document).bind('mousewheel DOMMouseScroll', function (event) {
              event.preventDefault();
              var delta = event.originalEvent.deltaX;
              init_scroll(event, delta);
          });
      }
      //funzione accessoria per lo scroll
      function init_scroll(event, delta) {
          // Cancel scroll if currently animating or within quiet period
          if (isAnimating) {
              event.preventDefault();
              return;
          }
          if (delta &lt; 0) {
              nextPager();
          } else {
              if (delta &gt; 0) {
                  previousPager();
              }
          }
      }
      //mappatura con le freccie su/giù
      $(document).keydown(function (e) {
          var tag = e.target.tagName.toLowerCase();
          switch (e.which) {
              case 37:
                  if (tag != 'input' &amp;&amp; tag != 'textarea') previousPager();
                  break;
              case 39:
                  if (tag != 'input' &amp;&amp; tag != 'textarea') nextPager();
                  break;
              default: return;
          }
      });
      //gestione dei tab singolo progetto
      init();
      return { init: init };
  
  }
  </code></pre>