src/js/htmlSanitizer.js
function finalizeHtml($html, needHtmlText) {
  let returnValue;

  if (needHtmlText) {
    returnValue = $html[0].innerHTML;
  } else {
    const frag = document.createDocumentFragment();
    const childNodes = util.toArray($html[0].childNodes);
    const {length} = childNodes;

    for (let i = 0; i < length; i += 1) {
      frag.appendChild(childNodes[i]);
    }
    returnValue = frag;
  }

  return returnValue;
}
function finalizeHtml($html, needHtmlText) {
  let returnValue;

  if (needHtmlText) {
    returnValue = $html[0].innerHTML;
  } else {
    const frag = document.createDocumentFragment();
    const childNodes = util.toArray($html[0].childNodes);
    const {length} = childNodes;

    for (let i = 0; i < length; i += 1) {
      frag.appendChild(childNodes[i]);
    }
    returnValue = frag;
  }

  return returnValue;
}
function finalizeHtml ( $html , needHtmlText ) { let returnValue ; if ( needHtmlText ) { returnValue = $html [ 0 ] . innerHTML ; } else { const frag = document . createDocumentFragment ( ) ; const childNodes = util . toArray ( $html [ 0 ] . childNodes ) ; const { length } = childNodes ; for ( let i = 0 ; i < length ; i += 1 ) { frag . appendChild ( childNodes [ i ] ) ; } returnValue = frag ; } return returnValue ; }
Finalize html result
@private
@param {jQuery} $html jQuery instance
@param {boolean} needHtmlText pass true if need html text
@returns {string|DocumentFragment} result
Finalize html result