Add ol.xml.isDocument

This commit is contained in:
Tom Payne
2014-02-04 15:39:28 +01:00
parent b63d0083f2
commit a5bb4632e5

View File

@@ -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.