1
0
mirror of https://github.com/openseadragon/openseadragon.git synced 2025-03-04 14:43:14 +03:00

Prefer DOMParser over ActiveX when both are availables.

This commit is contained in:
Antoine Vandecreme 2014-04-21 09:23:17 -04:00
parent 6a24af3743
commit e7ca7b1e95

@ -1947,21 +1947,7 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
* @returns {Document}
*/
parseXml: function( string ) {
//TODO: yet another example where we can determine the correct
// implementation once at start-up instead of everytime we use
// the function. DONE.
if ( window.ActiveXObject ) {
$.parseXml = function( string ){
var xmlDoc = null;
xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
xmlDoc.async = false;
xmlDoc.loadXML( string );
return xmlDoc;
};
} else if ( window.DOMParser ) {
if ( window.DOMParser ) {
$.parseXml = function( string ) {
var xmlDoc = null,
@ -1972,6 +1958,17 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
return xmlDoc;
};
} else if ( window.ActiveXObject ) {
$.parseXml = function( string ) {
var xmlDoc = null;
xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
xmlDoc.async = false;
xmlDoc.loadXML( string );
return xmlDoc;
};
} else {
throw new Error( "Browser doesn't support XML DOM." );
}