mirror of
https://github.com/openseadragon/openseadragon.git
synced 2025-02-08 02:49:22 +03:00
Prefer DOMParser over ActiveX when both are availables.
This commit is contained in:
parent
6a24af3743
commit
e7ca7b1e95
@ -1947,23 +1947,9 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
* @returns {Document}
|
* @returns {Document}
|
||||||
*/
|
*/
|
||||||
parseXml: function( string ) {
|
parseXml: function( string ) {
|
||||||
//TODO: yet another example where we can determine the correct
|
if ( window.DOMParser ) {
|
||||||
// implementation once at start-up instead of everytime we use
|
|
||||||
// the function. DONE.
|
|
||||||
if ( window.ActiveXObject ) {
|
|
||||||
|
|
||||||
$.parseXml = function( string ){
|
$.parseXml = function( string ) {
|
||||||
var xmlDoc = null;
|
|
||||||
|
|
||||||
xmlDoc = new ActiveXObject( "Microsoft.XMLDOM" );
|
|
||||||
xmlDoc.async = false;
|
|
||||||
xmlDoc.loadXML( string );
|
|
||||||
return xmlDoc;
|
|
||||||
};
|
|
||||||
|
|
||||||
} else if ( window.DOMParser ) {
|
|
||||||
|
|
||||||
$.parseXml = function( string ){
|
|
||||||
var xmlDoc = null,
|
var xmlDoc = null,
|
||||||
parser;
|
parser;
|
||||||
|
|
||||||
@ -1972,6 +1958,17 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
|
|||||||
return xmlDoc;
|
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 {
|
} else {
|
||||||
throw new Error( "Browser doesn't support XML DOM." );
|
throw new Error( "Browser doesn't support XML DOM." );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user