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

sizzle setDocument attaches infinite number of unload listeners #1874

Closed
reedz opened this issue Nov 20, 2014 · 4 comments
Closed

sizzle setDocument attaches infinite number of unload listeners #1874

reedz opened this issue Nov 20, 2014 · 4 comments
Assignees
Milestone

Comments

@reedz
Copy link

reedz commented Nov 20, 2014

Problem description: using jquery to select elements inside an iframe causes setDocument call, which per #14535 attaches an unload event listener.
Whenever it's used from event (e.g. onKeyDown), it may generate big amount of listeners, which will cause bad performance (at ~100 listeners added, adding a new one would cause around 15 ms on IE11)
Browser: IE 9-11
JS fiddle: http://jsfiddle.net/m9yn2t4L/

Possible solution:
replace

parent.addEventListener( "unload", function() {
                setDocument();
            }, false );

with

parent.addEventListener( "unload", setDocument, false );

(listeners not duplicated)

@timmywil timmywil added the Bug label Nov 20, 2014
@timmywil timmywil added this to the 3.0.0 milestone Nov 20, 2014
@timmywil timmywil self-assigned this Nov 20, 2014
@timmywil
Copy link
Member

Thanks for opening an issue. Confirmed.

timmywil referenced this issue in jquery/sizzle Dec 1, 2014
- Avoids attaching multiple handlers
- NOTE: removing the function wrapper completely causes a
  "Permission Denied" error in IE

Closes gh-1874
@timmywil
Copy link
Member

timmywil commented Dec 1, 2014

Fixed by jquery/sizzle@78a8c3a

@timmywil timmywil closed this as completed Dec 1, 2014
@timmywil timmywil reopened this Dec 1, 2014
@timmywil
Copy link
Member

timmywil commented Dec 1, 2014

To be closed when Sizzle is updated.

@timmywil
Copy link
Member

7602dc7

@dmethvin dmethvin modified the milestones: 1.11.2/2.1.2, 3.0.0 Dec 17, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jun 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants