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

Error in console at link selection #1151

Closed
MikeDevice opened this issue Jul 19, 2016 · 2 comments
Closed

Error in console at link selection #1151

MikeDevice opened this issue Jul 19, 2016 · 2 comments

Comments

@MikeDevice
Copy link

Description

If text contains a link and user tries to select this link, then follow error appears in console
Uncaught TypeError: Array.prototype.forEach called on null or undefined

Steps to reproduce

  1. Type some text
  2. Create a link at one word
  3. Select this link using mouse many times.

Expected behavior:
No errors in console

Actual behavior:
An error message outputs to the console

Link to an example:
JSFiddle

Versions

  • medium-editor: 5.21.0
  • browser: 51.0.2704.106 (64-bit)
  • OS: ubuntu 14.04 LTS
@nmielnik
Copy link
Member

Ah, I was finally able to get a repro on this! (thanks @MikeDevice).

Looks like the issue is within events.detachDOMEvent() and potentially events.attachDOMEvent(). We need to safety check to ensure the targets actually exists and is an array. Seems like with the anchor-preview mouse-out detection, there could be a case where we try to detach an event listener from an element that might not exist anymore.

@nmielnik
Copy link
Member

You can find more discussion about this same issue as part of #1137

@jwh315 jwh315 mentioned this issue Nov 23, 2016
j0k3r added a commit that referenced this issue Nov 24, 2016
@j0k3r j0k3r closed this as completed Nov 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants