I have a simple image i select with (i’ve also try on() and one()):
$container.find('.thumbnail img').load(function(){
$container.trigger('resize');
});
For some reason tho I get Uncaught RangeError: Maximum call stack size exceeded. I’m loading these images from an S3 instance if that matters. I know it does redirects a few times, but I dont think that’d matter.
Has anyone run into this or something similar. I don’t feel like this should ever be an infinite loop. This also happens intermittently which is more confusing.
The resize stuff:
publicMethod.resize = function (options) {
if (open) {
options = options || {};
if (options.width) {
settings.w = setSize(options.width, 'x') - loadedWidth - interfaceWidth;
}
if (options.innerWidth) {
settings.w = setSize(options.innerWidth, 'x');
}
$loaded.css({width: settings.w});
if (options.height) {
settings.h = setSize(options.height, 'y') - loadedHeight - interfaceHeight;
}
if (options.innerHeight) {
settings.h = setSize(options.innerHeight, 'y');
}
if (!options.innerHeight && !options.height && $loaded.find('iframe').length == 0) {
var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
settings.h = $child.height();
$child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
}
if("scrollTop" in options) {
settings.scrollTop = options.scrollTop;
}
$loaded.css({height: settings.h});
publicMethod.position(settings.transition === "none" ? 0 : settings.speed);
}
};
After a couple days of debugging this I finally tracked down the issue. The problem is a shim a developer on the Rails side a few months prior by Paul Irish that overrode an internal jQuery
special.addmethod which completely broke anyimg.load()stuff. The snippet looks like this (and it’s deployed all over the web actually, but doesn’t cause an issue until jQuery 1.6-1.7+So if you’re working on a large code base that uses jQuery and you’re getting call stack exceeded errors while trying to do an image load, this shim was probably added at some point.