replace the sugars in the html content.
@param {HTMLElement} ele Element witch the resolved html will be set on.
@param {*} html Html content to be replaced the sugars.
199989
function replaceHtml(ele, html) {
        var _this = this;

        if (ele.classList.contains('raw-text')) {
            return;
        }
        ele.innerHTML = withEscape( // eslint-disable-line no-undef
        function (html) {
            return function (reg, rep) {
                return _this.htmlSugars.reduce(function (html, _ref) {
                    var _ref2 = _slicedToArray(_ref, 2),
                        regExp = _ref2[0],
                        replace = _ref2[1];

                    return html.replace(regExp, replace);
                }, html).replace(reg, rep);
            };
        })(html);
    }
87091
function set(r) {
      if (isString(r)) {
        r = document.querySelector(r);
      }

      if (exist(r)) {
        Html._r = r;
      } else {
        warn('Root element must be a existing Html node');
      }
    }
1289373
function (elem) {
    this._forEachNode(this._getAllNodesWithTag(elem, ["br"]), function(br) {
      var next = br.nextSibling;

      // Whether 2 or more <br> elements have been found and replaced with a
      // <p> block.
      var replaced = false;

      // If we find a <br> chain, remove the <br>s until we hit another element
      // or non-whitespace. This leaves behind the first <br> in the chain
      // (which will be replaced with a <p> later).
      while ((next = this._nextElement(next)) && (next.tagName == "BR")) {
        replaced = true;
        var brSibling = next.nextSibling;
        next.parentNode.removeChild(next);
        next = brSibling;
      }

      // If we removed a <br> chain, replace the remaining <br> with a <p>. Add
      // all sibling nodes as children of the <p> until we hit another <br>
      // chain.
      if (replaced) {
        var p = this._doc.createElement("p");
        br.parentNode.replaceChild(p, br);

        next = p.nextSibling;
        while (next) {
          // If we've hit another <br><br>, we're done adding children to this <p>.
          if (next.tagName == "BR") {
            var nextElem = this._nextElement(next.nextSibling);
            if (nextElem && nextElem.tagName == "BR")
              break;
          }

          if (!this._isPhrasingContent(next)) break;

          // Otherwise, make this node a child of the new <p>.
          var sibling = next.nextSibling;
          p.appendChild(next);
          next = sibling;
        }

        while (p.lastChild && this._isWhitespace(p.lastChild)) p.removeChild(p.lastChild);
      }
    });
  }
857182
function filter(/*DOM*/ elem) {

		// execute and remove jbst:oninit method
		var method = popMethod(elem, INIT);
		if ('function' === typeof method) {
			// execute in context of element
			method.call(elem);
		}

		// execute and remove jbst:onload method
		method = popMethod(elem, LOAD);
		if ('function' === typeof method) {
			// queue up to execute after insertion into parentNode
			setTimeout(function() {
				// execute in context of element
				method.call(elem);
				method = elem = null;
			}, 0);
		}

		if (JsonML.BST.filter) {
			return JsonML.BST.filter(elem);
		}

		return elem;
	}
9261
function(method, args){
      _.each(this._elements, function(elem){
        if (_.isFunction(elem[method])){
          elem[method].apply(elem, args || []);
        }
      });
    }
727100
function (ele) {
            var node = this[0];
            //(ele string ??)
            if (node.nodeType === 1 || node.nodeType === 11 || node.nodeType === 9) {
                node.insertBefore(ele, node.firstChild);
            }
            return this;
        }
1217456
function(newNode, oldNode) {
        newNode = newNode.get ? newNode.get('element') : newNode;
        oldNode = oldNode.get ? oldNode.get('element') : oldNode;
        return this.get('element').replaceChild(newNode, oldNode);
    }
1321414
function() {
    var elTbody = this._elTbody;
    if(elTbody) {
        var elTable = elTbody.parentNode;
        Ev.purgeElement(elTbody, true);
        elTable.removeChild(elTbody);
        this._elTbody = null;
    }
}
318561
function(elem) {
      var t = this,
          strValue;

      // Catch recursive stringify
      try {strValue = JSON.stringify(elem.value);}
      catch (e) {strValue = "{object}";}

      // Set if the value changed
      if (strValue !== elem.strValue) {
        var priorStrValue = elem.strValue;
        elem.strValue = strValue;

        // Set the value of this element or the inner element
        elem.span.text(strValue);
        if (elem.innerView) {
          elem.innerView.model = elem.value;
          elem.innerView.setData();

          // Set the inner element open or closed
          var isClosed = false;
          if (priorStrValue) {
            isClosed = elem.innerView.isClosed;
          } else {
            isClosed = t.closedOnInit ? true : strValue.length < AUTO_CLOSE_CHARS;
          }
          t.toggleClosed(elem, isClosed);
        }
      }
    }
100460
public void replaceElement(final CmsContainerPageElementPanel elementWidget, final String elementId) {

        final CmsRpcAction<CmsContainerElementData> action = new CmsRpcAction<CmsContainerElementData>() {

            @Override
            public void execute() {

                start(500, true);
                getContainerpageService().replaceElement(
                    getData().getRpcContext(),
                    getData().getDetailId(),
                    getRequestParams(),
                    elementWidget.getId(),
                    elementId,
                    getPageState(),
                    getLocale(),
                    this);
            }

            @Override
            protected void onResponse(CmsContainerElementData result) {

                stop(false);

                if (result != null) {
                    // cache the loaded element
                    m_elements.put(result.getClientId(), result);
                    try {
                        replaceContainerElement(elementWidget, result);
                        resetEditButtons();
                        addToRecentList(result.getClientId(), null);
                        setPageChanged(new Runnable() {

                            public void run() {

                                // nothing to do

                            }
                        });
                    } catch (Exception e) {
                        // should never happen
                        CmsDebugLog.getInstance().printLine(e.getLocalizedMessage());
                    }
                }
            }
        };

        if (!isGroupcontainerEditing()) {

            lockContainerpage(new I_CmsSimpleCallback<Boolean>() {

                public void execute(Boolean arg) {

                    if (arg.booleanValue()) {
                        action.execute();
                    }
                }
            });

        } else {
            action.execute();
        }
    }
1294610
private static void replaceOrAppend(Element oldElement, Element newElement) {
    assert oldElement != null && newElement != null;

    if (matchesTags(oldElement, appendingTags)) {
      GQuery.$(oldElement).html("").append(newElement);
    } else {
      GQuery.$(oldElement).replaceWith(newElement);

      // copy class
      String c = oldElement.getClassName();
      if (!c.isEmpty()) {
        newElement.addClassName(c);
      }
      // copy id
      newElement.setId(oldElement.getId());
      // ensure no duplicate id
      oldElement.setId("");
    }
  }
626067
function(scope, element)
              {
                  // Compile the contents
                  if( !compiledContents )
                  {
                      compiledContents = $compile(contents);
                  }

                  // Re-add the compiled contents to the element
                  compiledContents( scope, function(clone)
                  {
                      element.append(clone);
                  });

                  // Call the post-linking function, if any
                  if ( link && link.post )
                  {
                      link.post.apply( null, arguments );
                  }

                  if ( angular.isFunction( postLink ) )
                  {
                    postLink.apply( null, arguments );
                  }
              }
1201566
function(el, sub) {
    sub = normalize(sub);

    DOM.removeAllListeners(el);
    DOM.clearData(el);
    DOM.clean(el);

    //el.parentNode.replaceChild(sub, el);
    el.parentNode.insertBefore(sub, el);
    el.parentNode.removeChild(el);

    return sub; 
  }
253925
function replaceElementPseudoMentions (element, selector) {
  const processor = selectorParser((selectors) => {
    let nodesToReplace = []

    /**
     * looping breaks if we replace dynamically
     * so instead collect an array of nodes to swap and do it at the end
     */
    selectors.each((selector) => {
      let onElementTag = false

      selector.each((node) => {
        if (node.type === 'tag' && node.value === element.tag) {
          onElementTag = true
        } else if (node.type === 'combinator') {
          onElementTag = false
        } else if (node.type === 'pseudo' && onElementTag) {
          const matchedPseudos = Object.entries(element.pseudos).filter(([ pseudo ]) => {
            return node.value.replace(/::?/, '') === pseudo
          })

          if (matchedPseudos.length > 0) {
            const [, value] = matchedPseudos[0]
            nodesToReplace.push({ node, value })
          }
        }
      })
    })

    nodesToReplace.forEach(({ node, value }) => node.replaceWith(` ${value}`))
  })

  return processor.process(selector).result
}
973611
function(el) {
            var self = this;

            self.callActions('beforeCacheDom', arguments);

            self.dom.el = el;

            self.callActions('afterCacheDom', arguments);
        }
803262
function replaceElement(element, attrs = {}) {
  const elementAttrs = getAttrs(element);
  const name = elementAttrs['data-feather'];
  delete elementAttrs['data-feather'];

  const svgString = icons[name].toSvg({
    ...attrs,
    ...elementAttrs,
    ...{ class: classnames(attrs.class, elementAttrs.class) },
  });
  const svgDocument = new DOMParser().parseFromString(
    svgString,
    'image/svg+xml',
  );
  const svgElement = svgDocument.querySelector('svg');

  element.parentNode.replaceChild(svgElement, element);
}
224982
function(html, element) {
      var template = document.createElement('template');
      template.innerHTML = html;
      var fragment = this.instanceTemplate(template);
      if (element) {
        element.textContent = '';
        element.appendChild(fragment);
      }
      return fragment;
    }