Bug Tracker

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13143 closed bug (fixed)

e.target can be a text node on mousewheel

Reported by: anonymous Owned by:
Priority: high Milestone: 2.0
Component: event Version: git
Keywords: Cc:
Blocked by: Blocking:


A recent change removed the code that normalized e.target to the parent element node in case it is a text node. This was removed because it apparently was an old Safari bug. However, it's still present in current Chrome.

Demo: http://jsfiddle.net/sbrjL/1/

Hover the text node and see the inconsistency:

  • IE9 shows "HTMLDivElement"
  • Chrome shows "Text"

Change History (6)

comment:1 Changed 4 years ago by anonymous

Err, I meant "scroll the text node", of course.

comment:2 Changed 4 years ago by dmethvin

Component: unfiledevent
Milestone: None2.0
Priority: undecidedhigh
Status: newopen

Thanks for testing and for the report! Well it looks like this check needs to go back in for now. Unfortunately we didn't have a unit test for it, and I'm still not sure we can make a non-contrived one.

For future reference, I don't see that a text node can be the target for any non-deprecated event listed here: http://www.w3.org/TR/DOM-Level-3-Events/#event-types-list

comment:3 Changed 4 years ago by Dave Methvin

Resolution: fixed
Status: openclosed

Fix #13143. Event target cannot be a text node.

Check removed in the initial 2.0 refactor but Chrome still needs it. No effective way to unit test; see the test case in #13143.

Changeset: c61150427fc8ccc8e884df8f221a6c9bb5477929

comment:4 Changed 4 years ago by mkwst@…

Filed https://bugs.webkit.org/show_bug.cgi?id=109939 upstream in WebKit. I've got a patch out for review.

comment:5 Changed 4 years ago by sp.shut@…

I get a 'Cannot read property nodeType of null' in jQuery.event.fix method when run inside cordova in android 2.3 device when deviceready event fires. A simple check for event.target && event.target.nodeType === 3 fixes the issue.

comment:6 Changed 4 years ago by dmethvin

@sp.shut, this is a closed bug and fixed in the current beta. If you have a different bug to report please create a new ticket and *include a test case* in addition to your description.

Note: See TracTickets for help on using tickets.