Skip to content

Fix eventInWidget exceptions on textNodes#3019

Closed
vincentwoo wants to merge 1 commit intocodemirror:masterfrom
vincentwoo:patch-3
Closed

Fix eventInWidget exceptions on textNodes#3019
vincentwoo wants to merge 1 commit intocodemirror:masterfrom
vincentwoo:patch-3

Conversation

@vincentwoo
Copy link
Copy Markdown
Contributor

Issue:

eventInWidget is sometimes passed events that have as their target a text node. These nodes do not support getAttribute, at least in Chrome. I think Firefox is okay.

Duplication:

Go to http://codemirror.net/demo/markselection.html (in Chrome), open the console, and then right click on the yellow highlighted text. An uncaught exception should fire.

Patch:

Check for the existence of getAttribute before trying to call it. Also, explicitly return false at end of function (this is just a stylistic change for clarity).

Hopefully this is the correct, intended behavior. Thanks again for your hard work on CodeMirror. I saw your tweet about not responding to patch requests too quickly to engender additional participation, so I figured I'd try to fix this one myself.

marijnh added a commit that referenced this pull request Jan 5, 2015
@marijnh
Copy link
Copy Markdown
Member

marijnh commented Jan 5, 2015

I've pushed a slightly different patch (0cb74f8) to take care of this. I was under the impression that event targets always were real nodes, but I guess that's not the case.

@marijnh marijnh closed this Jan 5, 2015
@vincentwoo vincentwoo deleted the patch-3 branch July 11, 2015 10:13
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.

2 participants