Popups fail in JQueryMobile 1.3.2 after update chrome version 43.0.2357.65 m

◇◆丶佛笑我妖孽 提交于 2019-11-29 10:42:54

The popup seems to be odd it's hard to replicate - Going to the exact link below and then clicking on the said "sign in" button seems to guarantee the behaviour. http://demos.jquerymobile.com/1.3.2/widgets/popup/#&ui-state=dialog

I believe the solution below may be related it fixes other fun issues with the slide transition. (only limited test with popup) but looks promising

Overriding the offending function with code snippet below. You have to call this before you load jquerymobile js

// Override of $.fn.animationComplete muse be called before initialise jquery mobile js
   $(document).bind('mobileinit', function() {
     $.fn.animationComplete = function(callback) {
       if ($.support.cssTransitions) {
         var superfy= "WebKitTransitionEvent" in window ? "webkitAnimationEnd" : "animationend";
         return $(this).one(superfy, callback);
       } else {

         setTimeout(callback, 0);
         return $(this);
       }
     };

   })

Background: jqueryMobile 1.3.2 implements the jquery one() event handler attachment somewhat incorrectly.

.one() - "Attach a handler to an event for the elements. The handler is executed at most once per element per event type." : http://api.jquery.com/category/events/ : essentially event fires and then is removed.

However calling both ("webkitAnimationEnd and animationend") using one() would potentially mean that only 1 (depending on browser) of the two handlers is ever fired leaving the other too linger and potentially cause memory leaks.

Chrome43 handles both webkitAniationEnd and animationend - however only one at any given time. This leaves the other to linger and fire off the next time animation on the element occurs.

As a workaround for me, it seems to work if you use the jQueryMobile API.

$('selector').popup('open');

instead of relying on the jQueryMobile markup

My Chrome Version is "43.0.2357.81 m" and I am experiencing this too

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!