work around jquery(mobile?) bug.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 6 Dec 2010 23:02:44 +0000 (18:02 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 6 Dec 2010 23:02:44 +0000 (18:02 -0500)
elt.parent() returns an empty array when there is no parent
(as would be the case when called on the activePage), use this to
determine when we can't move upwards anymore, and avoid javascript errors.

Also, remove unused variable.

imp/js/mobile.js

index 8e4d5e8..a26216d 100644 (file)
@@ -211,11 +211,9 @@ var ImpMobile = {
      */
     clickHandler: function(e)
     {
-        var elt = $(e.target),
-            orig = $(e.target),
-            id;
+        var elt = $(e.target), id;
 
-        while (elt && elt != window.document) {
+        while (elt && elt != window.document && elt.parent().length) {
             id = elt.attr('id');
 
             switch (id) {