Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix from @brukhabtu for issue 1492 - Errors when trying to delete DOM…

… elements.

- Check for existence of the bindings object before attempting to use it. Apparently jQuery core strips off any data bindings of an element before calling teardown on it to remove special event handlers.
  • Loading branch information...
commit d4c7b5da66641a3fd081a834ca3d12a5518d499b 1 parent b0e3d5f
Kin Blas jblas authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 js/jquery.mobile.vmouse.js
12 js/jquery.mobile.vmouse.js
View
@@ -370,7 +370,15 @@ function getSpecialEventObject(eventType)
var $this = $(this),
bindings = $.data(this, dataPropertyName);
- bindings[eventType] = false;
+
+ // teardown may be called when an element was
+ // removed from the DOM. If this is the case,
+ // jQuery core may have already stripped the element
+ // of any data bindings so we need to check it before
+ // using it.
+ if (bindings){
+ bindings[eventType] = false;
+ }
// Unregister the dummy event handler.
@@ -449,4 +457,4 @@ if (eventCaptureSupported){
}
}, true);
}
-})(jQuery, window, document);
+})(jQuery, window, document);
Please sign in to comment.
Something went wrong with that request. Please try again.