Merge pull request #1949 from openseadragon/ms-IE

Remove support for IE < 11 (fixes #1863)
This commit is contained in:
Ian Gilman 2021-03-10 09:39:08 -08:00 committed by GitHub
commit ab3f49abe3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 39 additions and 166 deletions

View File

@ -3,6 +3,8 @@ OPENSEADRAGON CHANGELOG
2.5.0: (In progress)
* BREAKING CHANGE: Dropped support for older browsers (IE < 11) (#1949 @msalsbery)
* BREAKING CHANGE: Removed deprecated OpenSeadragon.getEvent function (#1949 @msalsbery)
* DEPRECATION: MouseTracker exitHandler deprecated for name change to leaveHandler for consistency with DOM event names (#1872 @msalsbery)
* Now when "simple image" tile sources are removed from the viewer, they free the memory used by the pyramid they create (#1789 @TakumaKira)
* Documentation fix (#1814 @kenanchristian)
@ -33,6 +35,7 @@ OPENSEADRAGON CHANGELOG
* Viewer: added a canvas-contextmenu event (#1872 @msalsbery)
* Added additional documentation for the zoomPerSecond viewer option (#1872 @msalsbery)
* MouseTracker: Per #1863, dropped support for Internet Explorer < 11 (#1872 @msalsbery)
* Fixed simulated drag events in navigator tests (#1949 @msalsbery)
2.4.2:

View File

@ -1577,29 +1577,6 @@ function OpenSeadragon( options ){
},
/**
* Gets the latest event, really only useful internally since its
* specific to IE behavior.
* @function
* @param {Event} [event]
* @returns {Event}
* @deprecated For internal use only
* @private
*/
getEvent: function( event ) {
if( event ){
$.getEvent = function( event ) {
return event;
};
} else {
$.getEvent = function() {
return window.event;
};
}
return $.getEvent( event );
},
/**
* Gets the position of the mouse on the screen for a given event.
* @function
@ -1612,7 +1589,6 @@ function OpenSeadragon( options ){
$.getMousePosition = function( event ){
var result = new $.Point();
event = $.getEvent( event );
result.x = event.pageX;
result.y = event.pageY;
@ -1622,7 +1598,6 @@ function OpenSeadragon( options ){
$.getMousePosition = function( event ){
var result = new $.Point();
event = $.getEvent( event );
result.x =
event.clientX +
document.body.scrollLeft +
@ -1858,51 +1833,16 @@ function OpenSeadragon( options ){
/**
* Ensures an image is loaded correctly to support alpha transparency.
* Generally only IE has issues doing this correctly for formats like
* png.
* @function
* @param {String} src
* @returns {Element}
*/
makeTransparentImage: function( src ) {
var img = $.makeNeutralElement( "img" );
$.makeTransparentImage = function( src ){
var img = $.makeNeutralElement( "img" );
img.src = src;
img.src = src;
return img;
};
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 7 ) {
$.makeTransparentImage = function( src ){
var img = $.makeNeutralElement( "img" ),
element = null;
element = $.makeNeutralElement("span");
element.style.display = "inline-block";
img.onload = function() {
element.style.width = element.style.width || img.width + "px";
element.style.height = element.style.height || img.height + "px";
img.onload = null;
img = null; // to prevent memory leaks in IE
};
img.src = src;
element.style.filter =
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
src +
"', sizingMethod='scale')";
return element;
};
}
return $.makeTransparentImage( src );
return img;
},
@ -2144,23 +2084,7 @@ function OpenSeadragon( options ){
* @param {Event} [event]
*/
cancelEvent: function( event ) {
event = $.getEvent( event );
if ( event.preventDefault ) {
$.cancelEvent = function( event ){
// W3C for preventing default
event.preventDefault();
};
} else {
$.cancelEvent = function( event ){
event = $.getEvent( event );
// legacy for preventing default
event.cancel = true;
// IE < 9 for preventing default
event.returnValue = false;
};
}
$.cancelEvent( event );
event.preventDefault();
},
@ -2171,28 +2095,7 @@ function OpenSeadragon( options ){
* @param {Event} [event]
*/
eventIsCanceled: function( event ) {
event = $.getEvent( event );
if ( event.preventDefault ) {
$.eventIsCanceled = function( event ){
// W3C
return event.defaultPrevented;
};
} else {
$.eventIsCanceled = function( event ){
event = $.getEvent( event );
if ( typeof event.returnValue !== 'undefined' ) {
// IE < 9
return !event.returnValue;
} else if ( typeof event.cancel !== 'undefined' ) {
// legacy
return event.cancel;
} else {
return false;
}
};
}
return $.eventIsCanceled( event );
return event.defaultPrevented;
},
@ -2202,23 +2105,7 @@ function OpenSeadragon( options ){
* @param {Event} [event]
*/
stopEvent: function( event ) {
event = $.getEvent( event );
if ( event.stopPropagation ) {
// W3C for stopping propagation
$.stopEvent = function( event ){
event.stopPropagation();
};
} else {
// IE < 9 for stopping propagation
$.stopEvent = function( event ){
event = $.getEvent( event );
event.cancelBubble = true;
};
}
$.stopEvent( event );
event.stopPropagation();
},
@ -2407,25 +2294,7 @@ function OpenSeadragon( options ){
request.send(null);
} catch (e) {
var msg = e.message;
/*
IE < 10 does not support CORS and an XHR request to a different origin will fail as soon
as send() is called. This is particularly easy to miss during development and appear in
production if you use a CDN or domain sharding and the security policy is likely to break
exception handlers since any attempt to access a property of the request object will
raise an access denied TypeError inside the catch block.
To be friendlier, we'll check for this specific error and add a documentation pointer
to point developers in the right direction. We test the exception number because IE's
error messages are localized.
*/
var oldIE = $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 10;
if ( oldIE && typeof ( e.number ) !== "undefined" && e.number === -2147024891 ) {
msg += "\nSee http://msdn.microsoft.com/en-us/library/ms537505(v=vs.85).aspx#xdomain";
}
$.console.log( "%s while making AJAX request: %s", e.name, msg );
$.console.log( "%s while making AJAX request: %s", e.name, e.message );
request.onreadystatechange = function(){};
@ -2772,21 +2641,15 @@ function OpenSeadragon( options ){
//determine if this browser supports image alpha transparency
$.Browser.alpha = !(
(
$.Browser.vendor === $.BROWSERS.IE &&
$.Browser.version < 9
) || (
$.Browser.vendor === $.BROWSERS.CHROME &&
$.Browser.version < 2
)
$.Browser.vendor === $.BROWSERS.CHROME && $.Browser.version < 2
);
//determine if this browser supports element.style.opacity
$.Browser.opacity = !(
$.Browser.vendor === $.BROWSERS.IE &&
$.Browser.version < 9
);
$.Browser.opacity = true;
if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 11 ) {
$.console.error('Internet Explorer versions < 11 are not supported by OpenSeadragon');
}
})();

View File

@ -6,21 +6,13 @@
$.MouseTracker.subscribeEvents = [ "click", "dblclick", "keypress", "focus", "blur", $.MouseTracker.wheelEventName ];
if( $.MouseTracker.wheelEventName == "DOMMouseScroll" ) {
if( $.MouseTracker.wheelEventName === "DOMMouseScroll" ) {
// Older Firefox
$.MouseTracker.subscribeEvents.push( "MozMousePixelScroll" );
}
$.MouseTracker.havePointerEvents = false;
$.MouseTracker.unprefixedPointerEvents = true;
$.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave" );
if ( $.Browser.vendor !== $.BROWSERS.IE || $.Browser.version > 8 ) {
$.MouseTracker.subscribeEvents.push( "mouseover", "mouseout" );
$.MouseTracker.havePointerOverOut = true;
} else {
$.MouseTracker.havePointerOverOut = false;
}
$.MouseTracker.subscribeEvents.push( "mousedown", "mouseup", "mousemove" );
$.MouseTracker.subscribeEvents.push( "mouseenter", "mouseleave", "mouseover", "mouseout", "mousedown", "mouseup", "mousemove" );
$.MouseTracker.mousePointerId = "legacy-mouse";
// Legacy mouse events capture support (IE/Firefox only?)
$.MouseTracker.havePointerCapture = (function () {

View File

@ -222,13 +222,28 @@
};
var simulateNavigatorDrag = function (viewer, distanceX, distanceY) {
var $canvas = $(viewer.element).find('.displayregion'),
event = {
dx: Math.floor(distanceX),
dy: Math.floor(distanceY)
};
$canvas
.simulate('drag', event);
var $canvas = $(viewer.element).find('.openseadragon-canvas'),
offset = $canvas.offset(),
event = {};
event.clientX = offset.left + 1;
event.clientY = offset.top + 1;
$canvas.simulate( 'mouseenter', event );
event.button = 0;
$canvas.simulate( 'mousedown', event );
event.clientX += distanceX;
event.clientY += distanceY;
$canvas.simulate( 'mousemove', event );
event.button = 0;
$canvas.simulate( 'mouseup', event );
event.clientX = offset.left - 1;
event.clientY = offset.top - 1;
event.relatedTarget = document.body;
$canvas.simulate( 'mouseleave', event );
};
var dragNavigatorBackToCenter = function () {