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

use setTimeout rather than MutationObserver #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ashaffer
Copy link

MutationObserver may fire multiple times for very large pastes. For example, if you go to this page

http://www.2ality.com/2015/02/es6-classes-final.html

Press ctrl+a, ctrl+c and then paste into here:

http://requirebin.com/?gist=TooTallNate/789b7e9cefb8be3f8254

You will see that the domPaste callback is called multiple times, whereas only one paste event is fired.

@TooTallNate

EDIT: I should point out i've only tested this in Chrome. Not sure about other browsers.

EDIT2: Firefox does not seem to have the issue. Safari just plain chokes if you try to do such a crazy paste, so it may or may not have the issue with a paste of some intermediate level of insanity.

EDIT3: The issue appears to be connected to the presence of <iframe>'s in the paste. If you remove the iframe's from that page, the issue disappears - though it doesn't seem to get one additional event for each frame, so it's unclear to me exactly what is happening.

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

Successfully merging this pull request may close these issues.

1 participant