Просмотр исходного кода

fix: bail out of event blocking for iOS bug

close #9462
Evan You 7 лет назад
Родитель
Сommit
0bad7e2a35
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      src/platforms/web/runtime/modules/events.js

+ 9 - 1
src/platforms/web/runtime/modules/events.js

@@ -61,9 +61,17 @@ function add (
     const original = handler
     const original = handler
     handler = original._wrapper = function (e) {
     handler = original._wrapper = function (e) {
       if (
       if (
+        // no bubbling, should always fire.
+        // this is just a safety net in case event.timeStamp is unreliable in
+        // certain weird environments...
+        e.target === e.currentTarget ||
+        // event is fired after handler attachment
         e.timeStamp >= attachedTimestamp ||
         e.timeStamp >= attachedTimestamp ||
+        // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
+        e.timeStamp === 0 ||
         // #9448 bail if event is fired in another document in a multi-page
         // #9448 bail if event is fired in another document in a multi-page
-        // electron/nw.js app
+        // electron/nw.js app, since event.timeStamp will be using a different
+        // starting reference
         e.target.ownerDocument !== document
         e.target.ownerDocument !== document
       ) {
       ) {
         return original.apply(this, arguments)
         return original.apply(this, arguments)