mirror of
https://github.com/openseadragon/openseadragon.git
synced 2024-11-26 15:16:10 +03:00
Changed isInIframe to a variable for caching
This commit is contained in:
parent
703f922ed8
commit
2ab6f18cee
@ -1367,7 +1367,7 @@
|
|||||||
eventParams = getCaptureEventParams( tracker, $.MouseTracker.havePointerEvents ? 'pointerevent' : pointerType );
|
eventParams = getCaptureEventParams( tracker, $.MouseTracker.havePointerEvents ? 'pointerevent' : pointerType );
|
||||||
// We emulate mouse capture by hanging listeners on the document object.
|
// We emulate mouse capture by hanging listeners on the document object.
|
||||||
// (Note we listen on the capture phase so the captured handlers will get called first)
|
// (Note we listen on the capture phase so the captured handlers will get called first)
|
||||||
if (isInIframe() && canAccessEvents(window.top)) {
|
if (isInIframe && canAccessEvents(window.top)) {
|
||||||
$.addEvent(
|
$.addEvent(
|
||||||
window.top,
|
window.top,
|
||||||
eventParams.upName,
|
eventParams.upName,
|
||||||
@ -1410,7 +1410,7 @@
|
|||||||
eventParams = getCaptureEventParams( tracker, $.MouseTracker.havePointerEvents ? 'pointerevent' : pointerType );
|
eventParams = getCaptureEventParams( tracker, $.MouseTracker.havePointerEvents ? 'pointerevent' : pointerType );
|
||||||
// We emulate mouse capture by hanging listeners on the document object.
|
// We emulate mouse capture by hanging listeners on the document object.
|
||||||
// (Note we listen on the capture phase so the captured handlers will get called first)
|
// (Note we listen on the capture phase so the captured handlers will get called first)
|
||||||
if (isInIframe() && canAccessEvents(window.top)) {
|
if (isInIframe && canAccessEvents(window.top)) {
|
||||||
$.removeEvent(
|
$.removeEvent(
|
||||||
window.top,
|
window.top,
|
||||||
eventParams.upName,
|
eventParams.upName,
|
||||||
@ -3266,18 +3266,18 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function
|
* True if inside an iframe, otherwise false.
|
||||||
|
* @member {Boolean} isInIframe
|
||||||
* @private
|
* @private
|
||||||
* @inner
|
* @inner
|
||||||
* @returns {Boolean} True if inside an iframe, otherwise false.
|
|
||||||
*/
|
*/
|
||||||
function isInIframe () {
|
var isInIframe = (function() {
|
||||||
try {
|
try {
|
||||||
return window.self !== window.top;
|
return window.self !== window.top;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
})();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @function
|
* @function
|
||||||
|
Loading…
Reference in New Issue
Block a user