function _parseExtension(extNode) {
  // Ignore comments
  if (extNode.nodeName === '#comment') return null;
  var ext = createExtension();
  var extNodeAttrs = extNode.attributes;
  var childNodes = extNode.childNodes;
  ext.name = extNode.nodeName; // Parse attributes

  if (extNode.attributes) {
    for (var extNodeAttrKey in extNodeAttrs) {
      if (extNodeAttrs.hasOwnProperty(extNodeAttrKey)) {
        var extNodeAttr = extNodeAttrs[extNodeAttrKey];

        if (extNodeAttr.nodeName && extNodeAttr.nodeValue) {
          ext.attributes[extNodeAttr.nodeName] = extNodeAttr.nodeValue;
        }
      }
    }
  } // Parse all children


  for (var childNodeKey in childNodes) {
    if (childNodes.hasOwnProperty(childNodeKey)) {
      var parsedChild = _parseExtension(childNodes[childNodeKey]);

      if (parsedChild) {
        ext.children.push(parsedChild);
      }
    }
  }
  /*
    Only parse value of Nodes with only eather no children or only a cdata or text
    to avoid useless parsing that would result to a concatenation of all children
  */


  if (ext.children.length === 0 || ext.children.length === 1 && ['#cdata-section', '#text'].indexOf(ext.children[0].name) >= 0) {
    var txt = parserUtils.parseNodeText(extNode);

    if (txt !== '') {
      ext.value = txt;
    } // Remove the children if it's a cdata or simply text to avoid useless children


    ext.children = [];
  } // Only return not empty objects to not pollute extentions


  return isEmptyExtension(ext) ? null : ext;
}
/**
 * Parses an extension child node
 * @param {Node} extNode - The extension node to parse
 * @return {AdExtension|CreativeExtension|null} - The node parsed to extension
 */
Parses an extension child node
@param {Node} extNode - The extension node to parse
@return {AdExtension|CreativeExtension|null} - The node parsed to extension
Parses an extension child node @param { Node } extNode - The extension node to parse @return { AdExtension|CreativeExtension|null } - The node parsed to extension
function _parseExtension(extNode) {
  if (extNode.nodeName === '#comment') return null;
  var ext = createExtension();
  var extNodeAttrs = extNode.attributes;
  var childNodes = extNode.childNodes;
  ext.name = extNode.nodeName; 
  if (extNode.attributes) {
    for (var extNodeAttrKey in extNodeAttrs) {
      if (extNodeAttrs.hasOwnProperty(extNodeAttrKey)) {
        var extNodeAttr = extNodeAttrs[extNodeAttrKey];
        if (extNodeAttr.nodeName && extNodeAttr.nodeValue) {
          ext.attributes[extNodeAttr.nodeName] = extNodeAttr.nodeValue;
        }
      }
    }
  } 
  for (var childNodeKey in childNodes) {
    if (childNodes.hasOwnProperty(childNodeKey)) {
      var parsedChild = _parseExtension(childNodes[childNodeKey]);
      if (parsedChild) {
        ext.children.push(parsedChild);
      }
    }
  }
  if (ext.children.length === 0 || ext.children.length === 1 && ['#cdata-section', '#text'].indexOf(ext.children[0].name) >= 0) {
    var txt = parserUtils.parseNodeText(extNode);
    if (txt !== '') {
      ext.value = txt;
    } 
    ext.children = [];
  } 
  return isEmptyExtension(ext) ? null : ext;
}
function _parseExtension ( extNode ) { if ( extNode . nodeName === '#comment' ) return null ; var ext = createExtension ( ) ; var extNodeAttrs = extNode . attributes ; var childNodes = extNode . childNodes ; ext . name = extNode . nodeName ; if ( extNode . attributes ) { for ( var extNodeAttrKey in extNodeAttrs ) { if ( extNodeAttrs . hasOwnProperty ( extNodeAttrKey ) ) { var extNodeAttr = extNodeAttrs [ extNodeAttrKey ] ; if ( extNodeAttr . nodeName && extNodeAttr . nodeValue ) { ext . attributes [ extNodeAttr . nodeName ] = extNodeAttr . nodeValue ; } } } } for ( var childNodeKey in childNodes ) { if ( childNodes . hasOwnProperty ( childNodeKey ) ) { var parsedChild = _parseExtension ( childNodes [ childNodeKey ] ) ; if ( parsedChild ) { ext . children . push ( parsedChild ) ; } } } if ( ext . children . length === 0 || ext . children . length === 1 && [ '#cdata-section' , '#text' ] . indexOf ( ext . children [ 0 ] . name ) >= 0 ) { var txt = parserUtils . parseNodeText ( extNode ) ; if ( txt !== '' ) { ext . value = txt ; } ext . children = [ ] ; } return isEmptyExtension ( ext ) ? null : ext ; }
Parses an extension child node
 @param {Node} extNode - The extension node to parse
 @return {AdExtension|CreativeExtension|null} - The node parsed to extension
Parses an extension child node @param { Node } extNode - The extension node to parse @return { AdExtension|CreativeExtension|null } - The node parsed to extension
// Ignore comments // Parse attributes // Parse all children /*
    Only parse value of Nodes with only eather no children or only a cdata or text
    to avoid useless parsing that would result to a concatenation of all children
  */ // Remove the children if it's a cdata or simply text to avoid useless children // Only return not empty objects to not pollute extentions