an error occurred with click event on svg element using "live" or "delegate" #2826

Closed
castersupermild opened this Issue Oct 25, 2011 · 4 comments

Projects

None yet

4 participants

@castersupermild

confirmed in Google Chrome 14.0.835.202 on Windows7, iPad2 on iOS5.0(9A334)

In case of RC2: line 3112

error messsage(Chrome): uncaught TypeError: Cannot call method 'toLowerCase' of undefined
error message(Mobile Safari): TypeError: 'undefined' is not an object

Maybe modified like this:

before

        if ( ele.nodeName.toLowerCase() == "a" ) {

after

        if ( ele.nodeName && ele.nodeName.toLowerCase() == "a" ) {

This workaround will fixes raising the error,
but I cannot still handle the click event.
I think it's a problem with jQuery.

@toddparker
Contributor

Can you make a test page that only includes jQuery core and see if this problem still happens? If so, please log an issue in that tracker and close this. If it only happens with jQM included, please make a minimal test page using this template:
http://jsbin.com/umerar/edit

Thanks!

@castersupermild

In test page that only includes jQuery core an error does not occur. (But I cannot handle the event.) jQuery core only test page:
http://jsbin.com/umerar/18

In test page that includes jQM an error occurs. test page with jQM:
http://jsbin.com/umerar/14

SVG element that has symbol tag with path tag is type SVGElementInstance.
SVG element that does not has it is type SVGSVGElement.

In SVGElementInstance, element has not nodeName property and an error occurs.

I confirmed this problem happens in IE9, Chrome15.

@toddparker
Contributor

Thanks for following up. We'll take a look but this is tagged as a low priority issue.

@jblas jblas added a commit that referenced this issue Nov 16, 2011
@jblas jblas Fix for #2826 - an error occurred with click event on svg element usi…
…ng "live" or "delegate"

- Modified findClosestLink() to check the ele.nodeName type before trying to access it.
098eed9
@jblas
Contributor
jblas commented Nov 16, 2011

Fix landed on the HEAD:

098eed9

@jblas jblas closed this Nov 16, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment