在更新chrome版本43.0.2357.65 m之后,弹出窗口在JQueryMobile 1.3.2中失败 [英] Popups fail in JQueryMobile 1.3.2 after update chrome version 43.0.2357.65 m

查看:165
本文介绍了在更新chrome版本43.0.2357.65 m之后,弹出窗口在JQueryMobile 1.3.2中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最新的Chrome版本43.0.2357.65 m是否为其他人破坏了JQueryMobile 1.3.2?当我现在单击一个弹出窗口时,它会进入页面的顶部并且滚动条消失。



这个问题正在影响我的应用程序,但可以在JQueryMobile演示页面上重现:


  1. 使用Chrome 43.0.2357.65 m,请转至 http://demos.jquerymobile .com / 1.3.2 /

  2. 点击弹出

  3. 在弹出页面中点击登录按钮,


  4. $ b
    请注意,这不会每次都发生 - 如果再次尝试它可能会起作用,但是如果您从新选项卡开始这些步骤,它似乎会一直发生。



    我提出了Chrome的一个问题,但只是想知道是否有人知道发生了什么,以及是否有可以实施的解决方法。



    谢谢!

    解决方案

    弹出窗口似乎很奇怪,很难复制 -
    转到t他确切的链接在下面,然后点击上述登录按钮似乎可以保证行为。
    http://demos.jquerymobile.com/1.3.2 / widgets / popup /#& ui-state = dialog



    我相信下面的解决方案可能会与幻灯片转换修复其他有趣的问题。 (只有有限的弹出测试),但看起来很有前途
    $ b

    用下面的代码片段覆盖违规函数。
    您必须调用此函数在您加载jquerymobile js之前,您必须先安装jquerymobile js

    //覆盖$ .fn.animationComplete在初始化jquery mobile js $(document).bind( 'mobileinit',function(){$ .fn.animationComplete = function(callback){if($ .support.cssTransitions){var superfy =WebKitTransitionEventin window?webkitAnimationEnd:animationend; return $(this) .one(superfy,callback);} else {setTimeout(callback,0); return $(this);}};})


$ b 背景:
jqueryMobile 1.3.2实现了jquery one()事件处理程序附件,但有些不正确。



.one() - 将一个处理程序附加到元素的事件中。每个事件类型每个元素最多执行一次处理程序。 >: http://api.jquery.com/category/events/ :本质上是事件触发,然后被删除。然而,使用 one()调用(webkitAnimationEnd和animationend)可能意味着只有1 (取决于浏览器)两个处理程序被释放,而另一个处理程序过于冗长并可能导致内存泄漏。

Chrome43同时处理webkitAniationEnd和animationend - 但在任何给定时间只有一个。这会让对方留下来,并在下次元素动画发生时触发。


Has the latest chrome version "43.0.2357.65 m" broken JQueryMobile 1.3.2 for anyone else? When I click a popup now it goes to the top of the page and the scroll bar dissapears. It was fine in previous version.

The problem is affecting my applicaiton but is reproduceable on the JQueryMobile demo pages:

  1. Using Chrome 43.0.2357.65 m go to http://demos.jquerymobile.com/1.3.2/
  2. Click on popup
  3. On the popup page click on "Sign in" button halfway down the page.
  4. It will go to the top of the page and the scrollbar will have disappeared.

Note this doesn't happen every time - if you try it again it might work, but if you start the steps from a fresh tab it does appear to happen consistently.

I've raised an issue with Chrome but just wondering if anyone knows what's happening and if there's a workaround I can implement.

Thanks!

解决方案

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.

这篇关于在更新chrome版本43.0.2357.65 m之后,弹出窗口在JQueryMobile 1.3.2中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆