dependency-mjml.support.js
function mjmlElementParser(elem, content) {
  if (!elem) {
    throw new _Error.NullElementError('Null element found in mjmlElementParser');
  }

  var findLine = content.substr(0, elem.startIndex).match(/\n/g);
  var lineNumber = findLine ? findLine.length + 1 : 1;
  var tagName = elem.tagName.toLowerCase();
  var attributes = (0, _mapValues2.default)(_dom2.default.getAttributes(elem), function (val) {
    return decodeURIComponent(val);
  });

  var element = { tagName: tagName, attributes: attributes, lineNumber: lineNumber };

  if (_MJMLElementsCollection.endingTags.indexOf(tagName) !== -1) {
    var $local = _dom2.default.parseXML(elem);
    element.content = (0, _removeCDATA2.default)($local(tagName).html().trim());
  } else {
    var children = _dom2.default.getChildren(elem);
    element.children = children ? (0, _compact2.default)((0, _filter2.default)(children, function (child) {
      return child.tagName;
    }).map(function (child) {
      return mjmlElementParser(child, content);
    })) : [];
  }

  return element;
}
function mjmlElementParser(elem, content) {
  if (!elem) {
    throw new _Error.NullElementError('Null element found in mjmlElementParser');
  }

  var findLine = content.substr(0, elem.startIndex).match(/\n/g);
  var lineNumber = findLine ? findLine.length + 1 : 1;
  var tagName = elem.tagName.toLowerCase();
  var attributes = (0, _mapValues2.default)(_dom2.default.getAttributes(elem), function (val) {
    return decodeURIComponent(val);
  });

  var element = { tagName: tagName, attributes: attributes, lineNumber: lineNumber };

  if (_MJMLElementsCollection.endingTags.indexOf(tagName) !== -1) {
    var $local = _dom2.default.parseXML(elem);
    element.content = (0, _removeCDATA2.default)($local(tagName).html().trim());
  } else {
    var children = _dom2.default.getChildren(elem);
    element.children = children ? (0, _compact2.default)((0, _filter2.default)(children, function (child) {
      return child.tagName;
    }).map(function (child) {
      return mjmlElementParser(child, content);
    })) : [];
  }

  return element;
}
function mjmlElementParser ( elem , content ) { if ( ! elem ) { throw new _Error . NullElementError ( 'Null element found in mjmlElementParser' ) ; } var findLine = content . substr ( 0 , elem . startIndex ) . match ( / \n / g ) ; var lineNumber = findLine ? findLine . length + 1 : 1 ; var tagName = elem . tagName . toLowerCase ( ) ; var attributes = ( 0 , _mapValues2 . default ) ( _dom2 . default . getAttributes ( elem ) , function ( val ) { return decodeURIComponent ( val ) ; } ) ; var element = { tagName : tagName , attributes : attributes , lineNumber : lineNumber } ; if ( _MJMLElementsCollection . endingTags . indexOf ( tagName ) !== - 1 ) { var $local = _dom2 . default . parseXML ( elem ) ; element . content = ( 0 , _removeCDATA2 . default ) ( $local ( tagName ) . html ( ) . trim ( ) ) ; } else { var children = _dom2 . default . getChildren ( elem ) ; element . children = children ? ( 0 , _compact2 . default ) ( ( 0 , _filter2 . default ) ( children , function ( child ) { return child . tagName ; } ) . map ( function ( child ) { return mjmlElementParser ( child , content ) ; } ) ) : [ ] ; } return element ; }
converts MJML body into a JSON representation
converts MJML body into a JSON representation