From d2b7ab697f7abf6caa511cff2424f5fe1c7b498f Mon Sep 17 00:00:00 2001 From: Tom Payne Date: Tue, 4 Feb 2014 15:42:38 +0100 Subject: [PATCH] Add ol.xml.isNode --- src/ol/xml.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/ol/xml.js b/src/ol/xml.js index 6621186839..a2ea64fe6b 100644 --- a/src/ol/xml.js +++ b/src/ol/xml.js @@ -77,6 +77,33 @@ ol.xml.isDocument = goog.userAgent.IE ? ol.xml.isDocumentIE_ : ol.xml.isDocument_; +/** + * @param {?} value Value. + * @private + * @return {boolean} Is node. + */ +ol.xml.isNode_ = function(value) { + return value instanceof Node; +}; + + +/** + * @param {?} value Value. + * @private + * @return {boolean} Is node. + */ +ol.xml.isNodeIE_ = function(value) { + return goog.isObject(value) && goog.isDef(value.nodeType); +}; + + +/** + * @param {?} value Value. + * @return {boolean} Is node. + */ +ol.xml.isNode = goog.userAgent.IE ? ol.xml.isNodeIE_ : ol.xml.isNode_; + + /** * @param {string} xml XML. * @return {Document} Document.