0

I have a jQuery selector that gets an iframes <head>. In development the contents on the <head> look one way, but in production the <head> has fewer items because I minify many of them into a single file. Here is the selector:

$(ifr.contentWindow.document.head)

In development when I look at the contents of what that returns I can see everything in the head but in production it doesn't return everything. In production innerHTML of the selector shows nothing after this line:

<script src="javascript/lib-min.js?urlCacheBust=30102015102138908"></script>

Here are the full contents of the head tag in production. Why is everything after that line not reported in innerHTML?

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />


<meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>XXXXXXXXXXXX</title>



    <script>
        var gApplicationName = 'XXXXXXXX';
        var gSessionTimeoutMinutes = 'XXXXXXXX';
        var gShowSessionEstablishedMsg = false;
        var jspath = "javascript";
        var imgpath = "images";
    </script>




    <script type="text/javascript" src="javascript/jquery-1.8.2.min.js?urlCacheBust=30102015115027842"></script>

    <script type="text/javascript" src="css/autumn/jquery-ui.min.js?urlCacheBust=30102015115027842"></script>
    <link type="text/css" href="css/autumn/jquery-ui.min.css?urlCacheBust=30102015115027842" rel="stylesheet" />

    <script>jQuery.noConflict();</script>


        <script src="javascript/lib-min.js?urlCacheBust=30102015115027842"></script>
    <script src="javascript/jqPlugins/dump/jquery.dump.js?urlCacheBust=30102015115027842" type="text/javascript"></script>


    <link rel="stylesheet" type="text/css" media="screen" href="css/jqGrid/ui.jqgrid.css?urlCacheBust=30102015115027843"></link>

    <script>jQuery.jgrid.no_legacy_api = true;</script>



    <link rel="stylesheet" type="text/css" href="javascript/jqPlugins/gritter/gritter.css?urlCacheBust=30102015115027843"></link>



    <link rel='stylesheet' type='text/css' href='javascript/jqPlugins/fullcalendar/fullcalendar.css?urlCacheBust=30102015115027843' />
    <link rel='stylesheet' type='text/css' href='javascript/jqPlugins/fullcalendar/fullcalendar.print.css?urlCacheBust=30102015115027843' media='print' />

    <link rel="stylesheet" href="javascript/jqPlugins/validationEngine/validationEngine.jquery.css?urlCacheBust=30102015115027843" type="text/css"/>



    <link rel="stylesheet" type="text/css" href="javascript/jqPlugins/clockpicker/dist/jquery-clockpicker.css?urlCacheBust=30102015115027843">






    <link href="css/dhtmlwindowcss.css?urlCacheBust=30102015115027843" type="text/css" rel="stylesheet" />
    <link rel="shortcut icon" href="images/app_favicon.ico">


        <link title="legacytheme" href="css/autumn.css?urlCacheBust=30102015115027843" type="text/css" rel="stylesheet">


</head>

UPDATE - If I start removing the closing </script> tags then the innerHTML does make it further down. innerHTML now returns everything down to this line:

<script type="text/javascript">jQuery.jgrid.no_legacy_api = true;</script>

But I obviously can't remove that closing script tag. I've never seen behavior like this before.

UPDATE - In my batch file for making lib-min.js if I remove this, everything works: javascript\jqPlugins\jqGrid\jquery.jqGrid.min.js.

gfrobenius
  • 3,987
  • 8
  • 34
  • 66
  • Did the iframe fully loaded when you try to see its content? – fuyushimoya Oct 30 '15 at 15:55
  • Yes, in the console -> network tab I can view the entire contents of lib-min.js file as well as all the others. Then I click my button which runs that selector. – gfrobenius Oct 30 '15 at 16:05
  • This might be unrelated by I just noticed when viewing the network response of js files for the iframe and looking at the contents of the js files (in Chrome) the js has code color highlighting, except for the lib-min.js. It has no code color highlighting. It's all black text. Wondering if something is up with the format of the file. All the js in the minified file works just fine though. Maybe Chrome doesn't color code the js if its too large. Probably unrelated to problem but just thought I'd mention it. – gfrobenius Oct 30 '15 at 16:12

1 Answers1

0

This bug ended up being because of an old school modal popup we use called:

DHTML Modal window- By Dynamic Drive, available at: http://www.dynamicdrive.com

For some reason running Google Closure on its modal.js screws things up. I'm not sure as to what actually goes wrong but I know that after going through around 25+ js files that get minified it is this specific one that was causing the issue.

gfrobenius
  • 3,987
  • 8
  • 34
  • 66