wiki.techinc.nl/resources/lib/jquery.xmldom.js
Timo Tijhof 9f86db2028 resources: Move non-jquery files from /resources/lib/jquery to /resources/lib
Per discussion on T193826, these are not part of jquery (the library, or the
module), and should not be in the same subdirectory.

To follow the new convention that all entries directly in /resources/lib
should correspond to single library only (either as file, or as directory),
move them one directory up.

Bug: T193826
Change-Id: I24c05ec5fc5f0a2d54d501a4a022d829675bf850
2018-08-20 21:11:51 +00:00

46 lines
No EOL
1.2 KiB
JavaScript

/*!
* jQuery xmlDOM Plugin v1.0
* http://outwestmedia.com/jquery-plugins/xmldom/
*
* Released: 2009-04-06
* Version: 1.0
*
* Copyright (c) 2009 Jonathan Sharp, Out West Media LLC.
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*/
(function($) {
// IE DOMParser wrapper
if ( window['DOMParser'] == undefined && window.ActiveXObject ) {
DOMParser = function() { };
DOMParser.prototype.parseFromString = function( xmlString ) {
var doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML( xmlString );
return doc;
};
}
$.xmlDOM = function(xml, onErrorFn) {
try {
var xmlDoc = ( new DOMParser() ).parseFromString( xml, 'text/xml' );
if ( $.isXMLDoc( xmlDoc ) ) {
var err = $('parsererror', xmlDoc);
if ( err.length == 1 ) {
throw('Error: ' + $(xmlDoc).text() );
}
} else {
throw('Unable to parse XML');
}
} catch( e ) {
var msg = ( e.name == undefined ? e : e.name + ': ' + e.message );
if ( $.isFunction( onErrorFn ) ) {
onErrorFn( msg );
} else {
$(document).trigger('xmlParseError', [ msg ]);
}
return $([]);
}
return $( xmlDoc );
};
})(jQuery);