diff --git a/src/ol/xml.js b/src/ol/xml.js index 908b2e9516..6621186839 100644 --- a/src/ol/xml.js +++ b/src/ol/xml.js @@ -4,6 +4,7 @@ goog.require('goog.array'); goog.require('goog.asserts'); goog.require('goog.dom.NodeType'); goog.require('goog.object'); +goog.require('goog.userAgent'); /** @@ -48,6 +49,34 @@ ol.xml.getAllTextContent_ = function(node, normalizeWhitespace, accumulator) { }; +/** + * @param {?} value Value. + * @private + * @return {boolean} Is document. + */ +ol.xml.isDocument_ = function(value) { + return value instanceof Document; +}; + + +/** + * @param {?} value Value. + * @private + * @return {boolean} Is document. + */ +ol.xml.isDocumentIE_ = function(value) { + return goog.isObject(value) && value.nodeType == goog.dom.NodeType.DOCUMENT; +}; + + +/** + * @param {?} value Value. + * @return {boolean} Is document. + */ +ol.xml.isDocument = goog.userAgent.IE ? + ol.xml.isDocumentIE_ : ol.xml.isDocument_; + + /** * @param {string} xml XML. * @return {Document} Document.