AnsweredAssumed Answered

How can I avoid the "invalid argument" error in IE8?

Question asked by jcarney_voicenet on Jul 18, 2014
Latest reply on Jul 21, 2014 by jcarney_voicenet

Hello,

 

I've been struggling with this for two days, despite the fact that there is some documentation of this error out there. Until recently, I could load my map using IE8 fine, but now I'm getting an error "invalid argument" from the arcgis jsapi in IE8. Looking at this forum post , I realized it was the same issue, except that in my case, I was passing negative values into that style function which was breaking IE8. I downloaded the arcgis jsapi and tried to fix line 136 like so:

d={cssFloat:1,styleFloat:1,"float":1};l.get=function(a,b){var f=n.byId(a),h=arguments.length;if(2==h&&"opacity"==b)return k(f);b=d[b]?"cssFloat"in f.style?"cssFloat":"styleFloat":b;var m=l.getComputedStyle(f);return 1==h?m:e(f,b,m[b]||f.style[b])};l.set=function(a,b,f){var e=n.byId(a),k=arguments.length,m="opacity"==b;b=d[b]?"cssFloat"in e.style?"cssFloat":"styleFloat":b;console.log(f);console.log((typeof f==="string" && f.charAt(0)==="-")|| (typeof f!=="string" && typeof f!=="number"));if(3==k)return m?h(e,f):e.style[b]=((typeof f==="string" && f.charAt(0)==="-")|| (typeof f!=="string" && typeof f!=="number")?'0px':f);for(var r in b)l.set(a,r,b[r]);return l.getComputedStyle(e)};return l})},"dojo/dom-geometry":function(){define(["./sniff",

 

This did prevent the original error, but then an error occurred later in a similar line of code in something called vml.js, and I don't know where that file even is or where it's referenced. So I decided I'd like to try to fix this upstream instead, if possible. My map always used the jquery library without running into issues - in the attached html you'll see that I ordered my includes like so:

 

<script src="http://js.arcgis.com/3.9/"></script>

<script src="/eCNS/js/jquery.min.js"></script>

<script src="mapJS.js"></script>

 

I didn't use jquery as suggested here: Using jQuery | ArcGIS API for JavaScript, but it was working before regardless. One thing that has changed was the jquery library, which is why I was interested in whether that was issue. The jquery library we're using now is 1.11.1, and I believe that before it was 2.1.1, though I can't get that to work at all with my map now (may be a conflict with the overarching site's jquery. I don't even know if this is related to jquery, but if we can narrow that down to either being an issue or not, it would help.

 

Another complication with our site is that we load the map from a hidden iframe. This was consistently preventing the map from resizing itself properly, but it seemed to work reliably when we used the following code to handle window resizes.

 

    //resize map functions

    function resizeMapDiv() {

        var windowwidth = $(window).width();

        var windowheight = $(window).height();

        var newwidth = windowwidth - ($("#leftPane").width() + 20)

        var newheight = windowheight - ($("#header").height() + 20)

        $('#map').height(newheight).width(newwidth);

    }

 

    //was necessary to set a timer to get the map div to initialize to the correct size from the hidden iFrame

    var resizeTimeout;

    var mapLoaded = 0;

    $(window).resize(function () {

        if (iframeResizeComplete == 0) {

            iframeResizeComplete = 1;

            resizeTimeout = setTimeout(loadMapFncs, 700);

        } else if (iframeResizeComplete === 1 && mapLoaded === 1) {

            resizeMapDiv();

            map.resize();

            map.reposition();

        }

    });

 

So, I guess my questions are:

- could this be related to jquery?

- if I include jquery as a module, could that help?

- what other troubleshooting steps do you know that might work? I tried adapting this advice to my current versions, but I couldn't get it to work : IE bug using JSAPIv1.6 and BorderContainer

 

Thanks,

Jules

Attachments

Outcomes