0

I have a problem in displaying my map. It runs fine on IE, but it cant even load on Chrome (blank white page as if nothing is executed).

I find the problem in some css files : load-css.js and css.js. The error is : "Uncaught ReferenceError: normal is not defined". Click Here for the screenshot of the error. The error is at line 15 (js.css) and lines 59, 82, 4:373 (for load-js.css)

Here is the code for the js.css :

    //>>built
define("xstyle/css", ["require"], function(g) {
    function h(a, b, d) {
        var e = document.documentElement;
        a = e.insertBefore(document.createElement(a), e.firstChild);
        a.id = b;
        b = (a.currentStyle || getComputedStyle(a, null))[d];
        e.removeChild(a);
        return b
    }
    return {
        load: function(a, b, d, e) {
            function f() {
                var a = h("x-parse", null, "content");
                a && "none" != a ? b([eval(a)], d) : d()
            }
            var k = b.toUrl(a)
              , c = b.cache["url:" + k];
            if (c)
                return c.xCss && (c = c.cssText),
                g(["./util/createStyleSheet"], function(a) {
                    a(c)
                }),
                f();
            if ("none" == h("div", a.replace(/\//g, "-").replace(/\..*/, "") + "-loaded", "display"))
                return f();
            g(["./load-css"], function(a) {
                a(k, f)
            })
        }
    }
});

Here is the code for load-js.css

//>>built
define("xstyle/load-css", [], function() {
    function r(a, b) {
        var d = a[s]("link");
        d.rel = "stylesheet";
        d.type = "text/css";
        b && (d.href = b);
        return d
    }
    function t(a) {
        a = a.split("!");
        for (var b, d = 1; b = a[d++]; )
            b = b.split("\x3d", 2),
            a[b[0]] = 2 == b.length ? b[1] : !0;
        return a
    }
    function u(a) {
        if (g["dom-create-style-element"])
            return b = document.createElement("style"),
            b.setAttribute("type", "text/css"),
            b.appendChild(document.createTextNode(a)),
            m.insertBefore(b, m.firstChild),
            b;
        var b = document.createStyleSheet();
        b.cssText = a;
        return b.owningElement
    }
    var n = "onreadystatechange"
      , p = "onload"
      , s = "createElement"
      , q = !1
      , e = document
      , v = "undefined" == typeof _css_cache ? {} : _css_cache
      , g = {
        "event-link-onload": null === document.createElement("link").onload && !navigator.userAgent.match(/AppleWebKit/),
        "dom-create-style-element": !document.createStyleSheet
    }
      , m = e.head || (e.head = e.getElementsByTagName("head")[0]);
    if (!g["bundled-css"])
        var w = function(a, b) {
            function d(c) {
                if (c = c.sheet || c.styleSheet)
                    for (var a = document.styleSheets, b = a.length; 0 < b; b--)
                        if (a[b - 1] == c)
                            return !0
            }
            function h(c, a) {
                d(c.link) ? (e(c),
                a()) : q || setTimeout(function() {
                    h(c, a)
                }, c.wait)
            }
            function e(a) {
                a = a.link;
                a[n] = a[p] = null
            }
            function l() {
                k || (k = !0,
                b())
            }
            require.onError && (require.onError = function(a) {
                return function() {
                    q = !0;
                    a.apply(this, arguments)
                }
            }(require.onError));
            var k;
            (function(a, b) {
                var d = a.link;
                d[n] = d[p] = function() {
                    if (!d.readyState || "complete" == d.readyState)
                        g["event-link-onload"] = !0,
                        e(a),
                        b()
                }
            }
            )(a, l);
            g["event-link-onload"] || h(a, l)
        };
    return function(a, b, d) {
        for (var h = a.split(","), g = h.length, l = function() {
            0 == --g && b(f.sheet || f.styleSheet)
        }, k = 0; k < h.length; k++) {
            a = h[k];
            var c = v[a];
            if (c)
                return f = u(c),
                l();
            a = t(a);
            var c = a.shift()
              , c = c.lastIndexOf(".") <= c.lastIndexOf("/") ? c + ".css" : c
              , f = r(e);
            a = "nowait"in a ? "false" != a.nowait : !(!d || !d.cssDeferLoad);
            w({
                link: f,
                url: c,
                wait: d && d.cssWatchPeriod || 25
            }, l);
            a && b(f);
            f.href = c;
            m.appendChild(f)
        }
    }
});

I host the script locally : http://local_add/folder/arcgis_js_api/library/3.15/3.15/xstyle/css.js and /3.15/3.15/xstyle/load-css.js. These files are still original.

How can i fix this so that i can run it on chrome ?

0

Finally i found the solution here : https://community.esri.com/thread/177937

In css.js, search for the following text -

a&&"none"!=a

and replace it with -

a&&"none"!=a&&"normal"!=a

Problem is gone.

  • 1
    No need to modify the Esri source and that is not a good practice. The fix you mention was a temporary workaround to an issue with the Esri JavaScript API back in 2016. It was fixed quickly and newer versions of the API do not have this issue. – tmcgee Jan 10 at 14:50
  • Hi tmcgee, What version should i upgrade to ? Can you provide the download link ? many thanks – padjee Jan 11 at 2:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.