code: function toElement(str) {
      if (!range && doc.createRange) {
          range = doc.createRange();
          range.selectNode(doc.body);
      }
  
      var fragment;
      if (range && range.createContextualFragment) {
          fragment = range.createContextualFragment(str);
      } else {
          fragment = doc.createElement('body');
          fragment.innerHTML = str;
      }
      return fragment.childNodes[0];
  }
docs: This is about the same
  var html = new DOMParser().parseFromString(str, 'text/html');
  return html.body.firstChild;
  
  @method toElement
  @param {String} str