]> source.dussan.org Git - jquery.git/commitdiff
Fix #13143. Event target cannot be a text node.
authorDave Methvin <dave.methvin@gmail.com>
Sun, 6 Jan 2013 15:24:56 +0000 (10:24 -0500)
committerDave Methvin <dave.methvin@gmail.com>
Sun, 6 Jan 2013 15:25:02 +0000 (10:25 -0500)
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.

src/event.js

index 733e563c28e92b72f596dd71c97c4819bedf62fd..da3ac312e91218f1aaaf932ab0e1a22f192fa2eb 100644 (file)
@@ -470,6 +470,12 @@ jQuery.event = {
                        event[ prop ] = originalEvent[ prop ];
                }
 
+               // Target should not be a text node (#504, #13143)
+               // Support: Chrome 23+, Safari?
+               if ( event.target.nodeType === 3 ) {
+                       event.target = event.target.parentNode;
+               }
+
                return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
        },