Errors when trying to delete DOM elements #1492

Closed
brukhabtu opened this Issue Apr 20, 2011 · 3 comments

Projects

None yet

2 participants

@brukhabtu

I have some elements I am adding and deleting and I occasionally get this error. The library I am using is not my own and can be found http://code.google.com/p/django-dynamic-formset/ .

Uncaught TypeError: Cannot set property 'vmouseover' of undefined
teardownbrukhabtu.com/js/jquery.mobile-1.0a4.1.js:867
jQuery.event.removecode.jquery.com/jquery-1.5.2.js:2385
jQuery.event.removecode.jquery.com/jquery-1.5.2.js:2352
jQuery.extend.cleanDatacode.jquery.com/jquery-1.5.2.js:5697
$.cleanDatabrukhabtu.com/js/jquery.mobile-1.0a4.1.js:27
jQuery.fn.extend.removecode.jquery.com/jquery-1.5.2.js:5190
$.fn.formset.insertDeleteLinkbrukhabtu.com/js/jquery.formset.js:62
jQuery.event.handlecode.jquery.com/jquery-1.5.2.js:2568
jQuery.event.add.elemData.handle.eventHandlecode.jquery.com/jquery-1.5.2.js:2207

I have found a fix for this but since I know nearly nothing about jquery mobile's inner workings it may break things more. Here is the fix.

Replace
bindings[eventType] = false; // line 867

with:
if (bindings != undefined) {bindings[eventType] = false;}

If someone who understands the code a bit more can assure me that this doesn't break anything in the long run i will request for a pull.

@jblas
Contributor
jblas commented Apr 20, 2011

Hi @brukhabtu,

We could certainly check an undefined bindings data value. I just want to confirm with some folks in the know if stripping of element data before teardown is called, is expected behavior. It seems like stripping of data should happen AFTER just in case the special event needed something in the data to aid with cleanup.

@jblas jblas was assigned Apr 20, 2011
@jblas
Contributor
jblas commented Apr 21, 2011

@brukhabtu

I landed your fix with some additional comments and gave you credit.

d4c7b5d

Thanks for finding, filing, and fixing. :-)

  • Kin
@jblas jblas closed this Apr 21, 2011
@brukhabtu

Thanks, glad to be of some help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment