diff options
author | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-02-14 12:06:16 +0100 |
---|---|---|
committer | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-02-14 12:19:50 +0100 |
commit | a03d70209fabbb3d2ae7137a6edde1f0712cd9e1 (patch) | |
tree | f612049a2dbe1f28a65deec26a1f7a03d0d7eafa /apps | |
parent | bfe6334cd9d50ce99f0a6fd02c1aa0dc43b2b7e9 (diff) | |
download | nextcloud-server-a03d70209fabbb3d2ae7137a6edde1f0712cd9e1.tar.gz nextcloud-server-a03d70209fabbb3d2ae7137a6edde1f0712cd9e1.zip |
fixing undefined originalEvent
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/js/jquery-visibility.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/files/js/jquery-visibility.js b/apps/files/js/jquery-visibility.js index a824bf68730..18f57d1f2bd 100644 --- a/apps/files/js/jquery-visibility.js +++ b/apps/files/js/jquery-visibility.js @@ -3,7 +3,7 @@ var prefix, property, -// In Opera, `'onfocusin' in document == true`, hence the extra `hasFocus` check to detect IE-like behavior + // In Opera, `'onfocusin' in document == true`, hence the extra `hasFocus` check to detect IE-like behavior eventName = 'onfocusin' in document && 'hasFocus' in document ? 'focusin focusout' : 'focus blur', prefixes = ['', 'moz', 'ms', 'o', 'webkit'], $support = $.support, @@ -19,12 +19,11 @@ $(/blur$/.test(eventName) ? window : document).on(eventName, function (event) { var type = event.type, - originalEvent = event.originalEvent, - toElement = originalEvent.toElement; -// If it’s a `{focusin,focusout}` event (IE), `fromElement` and `toElement` should both be `null` or `undefined`; -// else, the page visibility hasn’t changed, but the user just clicked somewhere in the doc. -// In IE9, we need to check the `relatedTarget` property instead. - if (!/^focus./.test(type) || (toElement == undefined && originalEvent.fromElement == undefined && originalEvent.relatedTarget == undefined)) { + originalEvent = event.originalEvent; + // If it’s a `{focusin,focusout}` event (IE), `fromElement` and `toElement` should both be `null` or `undefined`; + // else, the page visibility hasn’t changed, but the user just clicked somewhere in the doc. + // In IE9, we need to check the `relatedTarget` property instead. + if (!/^focus./.test(type) || originalEvent == undefined || (originalEvent.toElement == undefined && originalEvent.fromElement == undefined && originalEvent.relatedTarget == undefined)) { $event.trigger((property && document[property] || /^(?:blur|focusout)$/.test(type) ? 'hide' : 'show') + '.visibility'); } }); |