Skip to content
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

Using the jquery plugin's removeResize function on "$(window)" throws an exception. #47

Open
JoolsCaesar opened this issue Jun 7, 2017 · 1 comment

Comments

@JoolsCaesar
Copy link

I have some code that calls
$(container).resize(myFunc);
and then later
$(container).removeResize(myFunc);

Sometimes the container is an element, other times it is the window object. The resize function has check for when this == window and forwards to the default jquery resize handler. There is no such check in the removeResize function so it goes about trying to splice __resizeListeners__ which don't exist and throws an exception.

Uncaught TypeError: Cannot read property 'splice' of undefined

@neallred
Copy link

neallred commented Mar 8, 2018

For those reaching this page when upgrading to jQuery 3.2.1, the same exception gets thrown because __resizeListeners__ is not set on the element if you use jQuery's recommended .on('resize' instead of .resize. This plugin creates a wrapper around $.fn.resize, as per @JoolsCaesar's comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants