-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSONP Error: function cX does not exist on window._EsriLeafletCallbacks #762
Comments
thanks for logging the issue! just to be clear, you're suggesting that we reverse the order of operations in the code block here, correct?
in what circumstances are you seeing this? what is the resulting behavior? |
No problem, thanks for the quick reply. Yes, those are the code blocks I'm referring to. When using IE9, or in IE9 mode (though it could affect any browser that doesn't support CORS) the script tag returns and loads before the "window._EsriLeafletCallbacks[callbackId]" is set. When the resulting script is evaluated it attempts to execute the function (in this case "window._EsriLeafletCallbacks.c0") , which hasn't been set, the "Object doesn't support property or method 'c0'" error is thrown (attached image). We're seeing it when the _getAttributionData function is called during initialization, but that's only because it's the first JSONP call being made. Oddly enough, I can't reproduce this when the developer panel is open in IE, probably because it's more of a timing issue. I didn't see any closures inside the callback, so it seemed safe enough to reverse the order of operations, and testing seems to confirm that so far. Date: Mon, 21 Mar 2016 12:14:03 -0700 thanks for logging the issue! just to be clear, you're suggesting that we reverse the order of operations in the code block here, correct? In certain cases the script tag loads and attempts to execute before the callback property is set. in what circumstances are you seeing this? what is the resulting behavior? — |
awesome. thanks for all the info. i'll test a little myself and submit a patch shortly unless anyone else wants to take a stab at submitting their own pull request with the fix you outlined. |
In certain cases the script tag loads and attempts to execute before the callback property is set. Creating the JSONP script tag after the callback property is set on the 'window._EsriLeafletCallbacks' object eliminates that possibility:
window._EsriLeafletCallbacks[callbackId] = function (response) {...};
var script = L.DomUtil.create('script', null, document.body);...
script.id = callbackId;
The text was updated successfully, but these errors were encountered: