Replace the content between container's tags. Requires container to be in DOM
@param {string} html
168482
function(html) {

		if (!this._is_inDOM) Lava.t("setHTML: container is not in DOM");

		Firestorm.DOM.clearInnerRange(this.getStartElement(), this.getEndElement());
		Firestorm.DOM.insertHTMLBefore(this.getEndElement(), html);

	}
879208
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);
            };
        }
609430
function replace(match, text) {
        var rng = rangeFromMatch(match);

        rng.deleteContents();

        if (text.length > 0) {
          rng.insertNode(editor.dom.doc.createTextNode(text));
        }

        return rng;
      }
124778
function resolvehtml(html, holders) {
	Object.keys(holders).forEach(function(key) {
		html = html.replace(placeholder(key), holders[key]);
	});
	return html;
}
1130964
function replaceText(id, text) {
    var element = document.getElementById(id)
    if (null == element) {
//      alert("error: can't find element with id '" + id + "'")
        return
    }

    element.innerHTML = text
}
931365
function before(element, content) {
  if (isString(content)) {
    return element.insertAdjacentHTML('beforeBegin', content);
  } else {
    return element.parentNode.insertBefore(normalizeContent(content), element);
  }
}
321628
function ( Value, Container ) {
			var Option = L.DomUtil.create( 'option', '', Container );
			Option.innerHTML = Value;
			
			return Option;
		}
779911
function fragment(html) {
  var args = arguments;
  var div = document.createElement('div');
  var i = 1;

  div.innerHTML = html.replace(/%([se])/g, function(_, type) {
    switch (type) {
      case 's':
        return String(args[i++]);
      case 'e':
        return escape(args[i++]);
      // no default
    }
  });

  return div.firstChild;
}
1283768
function _mkdom(templ, html) {

    var match = templ && templ.match(/^\s*<([-\w]+)/),
      tagName = match && match[1].toLowerCase(),
      rootTag = rootEls[tagName] || GENERIC,
      el = mkEl(rootTag)

    el.stub = true

    // replace all the yield tags with the tag inner html
    if (html) templ = replaceYield(templ, html)

    /* istanbul ignore next */
    if (checkIE && tagName && (match = tagName.match(SPECIAL_TAGS_REGEX)))
      ie9elem(el, templ, tagName, !!match[1])
    else
      el.innerHTML = templ

    return el
  }
160860
public function replaceTokens(string $HTML)
    {
        $scripts = $this->resolveAssets($this->scripts, "js");
        $CSS = $this->resolveAssets($this->CSS, "css");

        // Initialize all output variables to null
        $values = new TypedDictionary(
            [
                'css_document' => new Validator(Type::OBJECT, ['class' => DOMDocument::class]),
                'js_document' => new Validator(Type::OBJECT, ['class' => DOMDocument::class]),
                'js_inline_document' => new Validator(Type::OBJECT, ['class' => DOMDocument::class]),
                'css_files' => Type::ARRAY,
                'js_files' => Type::ARRAY,
                'js_inline_variables' => Type::ARRAY
            ],
            [
                'js_files' => $scripts,
                'css_files' => $CSS,
                'js_inline_variables' => $this->inline_variables
            ]
        );

        // Allow hooks to modify the scripts and CSS before modifying them
        Hook::execute('Wedeto.HTML.AssetManager.replaceTokens.preRender', $values);

        // Do rendering
        $js = $values->getArray('js_files');
        if (!empty($js) && !$values->has('js_document'))
        {
            $js_doc = new DOMDocument;
            foreach ($js as $script)
            {
                $element = $js_doc->createElement('script');
                $element->setAttribute('src', $script['url']);
                $js_doc->appendChild($element);
            }
            $values['js_document'] = $js_doc;
        }
        
        $jsv = $values->getArray('js_inline_variables');
        if (!empty($jsv) && !$values->has('js_inline_document'))
        {
            $js_inline_doc = new DOMDocument;
            $code_lines = ['window.wdt = {};'];
            foreach ($jsv as $name => $value)
                $code_lines[] = "window.wdt.$name = " . json_encode($value) . ";";
            $variable_el = $js_inline_doc->createElement('script', implode("\n", $code_lines));
            $js_inline_doc->appendChild($variable_el);
            $values['js_inline_document'] = $js_inline_doc;
        }

        $CSS = $values->getArray('css_files');
        if (!empty($CSS) && !$values->has('css_document'))
        {
            $CSS_doc = new DOMDocument;
            foreach ($CSS as $stylesheet)
            {
                $element = $CSS_doc->createElement('link');
                $element->setAttribute('rel', 'stylesheet');
                $element->setAttribute('href', $stylesheet['url']);
                $element->setAttribute('type', 'text/css');
                $CSS_doc->appendChild($element);
            }
            $values['css_document'] = $CSS_doc;
        }

        // Allow hooks to modify the output
        Hook::execute('Wedeto.HTML.AssetManager.replaceTokens.postRender', $values);

        $script_HTML = $values->has('js_document') ? trim($values['js_document']->saveHTML()) : '';
        $CSS_HTML = $values->has('css_document') ? trim($values['css_document']->saveHTML()) : '';
        $inline_script_HTML = $values->has('js_inline_document') ? trim($values['js_inline_document']->saveHTML()) : '';

        $count = 0;
        $HTML = str_replace($this->injectScript(), $script_HTML . $inline_script_HTML, $HTML, $count);
        if ($count === 0 && !empty($script_HTML))
        {
            self::$logger->warning("No Javascript marker found while there are scripts to insert");
            self::$logger->debug("To-be inserted scripts: {0}", $js);
        }

        $count = 0;
        $HTML = str_replace($this->injectCSS(), $CSS_HTML, $HTML, $count);
        if ($count === 0 && !empty($CSS_HTML))
        {
            self::$logger->warning("No CSS marker found while there are stylesheets to insert");
            self::$logger->debug("To-be inserted stylesheets: {0}", [$CSS]);
        }

        // Tidy up HTML when configured and available
        if ($this->tidy)
        {
            if (class_exists("Tidy", false))
            {
                $tidy = new \Tidy();
                $config = array('indent' => true, 'indent-spaces' => 4, 'wrap' => 120, 'markup' => true, 'doctype' => 'omit');
                $HTML = "<!DOCTYPE html>\n" . $tidy->repairString($HTML, $config, "utf8");
            }
            else
            {
                // @codeCoverageIgnoreStart
                self::$logger->warning("Tidy output has been requested, but Tidy extension is not available");
                // @codeCoverageIgnoreEnd
            }
        }
        return $HTML;
    }
1124927
function(content) {
        if (content) {
            if (content._node) { // map to DOMNode
                content = content._node;
            } else if (content._nodes) { // convert DOMNodeList to documentFragment
                content = Y_DOM._nl2frag(content._nodes);
            }

        }

        Y_DOM.addHTML(this._node, content, 'replace');
        return this;
    }
1650
function createDomElementFromTemplate(html) {
    //match container markers like <@element/>
    let containerTags = html.match(rContainerGlobal) || [];

    for (let containerTag of containerTags) {
        let [, containerName, attrs = ''] = rContainer.exec(containerTag);
        let template = `<script type="x" ${ATTR}="${containerName}">${attrs.trim()}</script>`;

        html = html.split(containerTag).join(template);
    }

    //match attribute markers like <span @element></span>
    let allTags = html.match(rTags) || [];

    for (let tag of allTags) {
        let result = rAttr.exec(tag);

        if (result) {
            let elName = result[1];
            html = html.split(tag).join(tag.replace(`@${elName}`, `${ATTR}="${elName}"`));
        }
    }

    return $.create(html.trim());
}
724917
function replaceString(content, search, replace) {
        var index = 0;

        do {
          index = content.indexOf(search, index);

          if (index !== -1) {
            content = content.substring(0, index) + replace + content.substr(index + search.length);
            index += replace.length - search.length + 1;
          }
        } while (index !== -1);

        return content;
      }
1042481
function (content) {

            content = helpers.replaceCustom(content, /<script.+src=['"](.+)["'][\/>]?><[\\]?\/script>/gm);

            content = helpers.replaceCustom(content, /<link[^\>]+href=['"]([^"']+)["']/gm);

            return content;
        }
245851
function (html) {
        const editor = this.editor
        const range = editor.selection.getRange()

        if (this.queryCommandSupported('insertHTML')) {
            // W3C
            this._execCommand('insertHTML', html)
        } else if (range.insertNode) {
            // IE
            range.deleteContents()
            range.insertNode($(html)[0])
        } else if (range.pasteHTML) {
            // IE <= 10
            range.pasteHTML(html)
        } 
    }
247092
function( title ) {
		this.element.attr( 'title', lm.utils.stripTags( title ) );
		this.titleElement.html( title );
	}
1178021
function modifyHTML(page, operations) {
    var html = page.getContent();
    var $ = cheerio.load(html);

    return Promise.forEach(operations, function(op) {
        return op($);
    })
    .then(function() {
        var resultHTML = $.html();
        return page.set('content', resultHTML);
    });
}