Why doesn't jQuery use requestAnimationFrame?

后端 未结 3 1445
暖寄归人
暖寄归人 2020-11-30 22:09

Some browsers support requestAnimationFrame, so why not use it? After all, it\'s been supported since Google Chrome 10. Despite that, jQuery does not seem to be

3条回答
  •  [愿得一人]
    2020-11-30 22:39

    In ticket #9381 you can read why they stopped using requestionAnimationFrame after some time.

    To summarize, problems were that animations didn't run (browsers try to reduce CPU load) when window didn't have focus, which is OK if the window is hidden, but not if it is visible, just out of the focus. Furthermore, animation queues piled up and after window regained focus, things went berserk. This would require ugly changes in the code and/or changes how people add things to the animation queue. So it was decided that support is removed until there is some better way to do this.

提交回复
热议问题