Return a DOM fragment from `html`.

@param {string} html
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;
}
6861
def fromHTML(html, *args, **kwargs):
        
        source = BeautifulSoup(html, 'html.parser', *args, **kwargs)
        return TOC('[document]',
            source=source,
            descendants=source.children)
847228
def html(self) -> str:
        """"""
        if self._inner_element:
            return self.start_tag + self._inner_element.html + self.end_tag
        return super().html
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());
}
624693
public static String html(String html) {
        StringBuilder sb = createStringBuilder(html.length());
        html(sb, html);
        return sb.toString();
    }
1322017
function html(opts) {
  opts = opts || {}
  var parent = opts.target =  createElement();
  parent.innerHTML = opts.content;
  Splitting(opts)
  return parent.outerHTML
}
1225197
function( html ) {
					try {
						var $ = this.$;

						// Fix the case when setHtml is called on detached element.
						// HTML5 shiv used for document in which this element was created
						// won't affect that detached element. So get document fragment with
						// all HTML5 elements enabled and set innerHTML while this element is appended to it.
						if ( this.getParent() )
							return ( $.innerHTML = html );
						else {
							var $frag = this.getDocument()._getHtml5ShivFrag();
							$frag.appendChild( $ );
							$.innerHTML = html;
							$frag.removeChild( $ );

							return html;
						}
					}
					catch ( e ) {
						this.$.innerHTML = '';

						var temp = new CKEDITOR.dom.element( 'body', this.getDocument() );
						temp.$.innerHTML = html;

						var children = temp.getChildren();
						while ( children.count() )
							this.append( children.getItem( 0 ) );

						return html;
					}
				}
1268726
function (element) {
      var el = element.dom();
      var defaultView = el.ownerDocument.defaultView;
      return Element.fromDom(defaultView);
    }
391926
public static String stripHtml(String html) {

        if (html == null) {
            return null;
        }
        Element el = DOM.createDiv();
        el.setInnerHTML(html);
        return el.getInnerText();
    }
1130732
function() {
      var clonedTestElement = testElement.cloneNode(false),
          returnValue,
          innerHTML;

      clonedTestElement.innerHTML = "<p><div></div>";
      innerHTML                   = clonedTestElement.innerHTML.toLowerCase();
      returnValue                 = innerHTML === "<p></p><div></div>" || innerHTML === "<p><div></div></p>";

      // Cache result by overwriting current function
      this.autoClosesUnclosedTags = function() { return returnValue; };

      return returnValue;
    }
646923
function createHTML(htmlStr) {
        var frag = document.createDocumentFragment(),
            temp = document.createElement('div');
        temp.innerHTML = htmlStr;
        while (temp.firstChild) {
            frag.appendChild(temp.firstChild);
        }
        return frag;
    }
666359
function processHTML() {
            /**
             * Genetrate an iterator of the index where non whitespace appear
             * @param {string} text The text to set
             * @returns {number} The index
             */
            function* genWordStartIndices(text) {
                if (!text.trim()) {
                    return
                }
                const re = /\s/u
                let preIsWhitespace = true
                let i = 0
                for (const c of text) {
                    const isWhitespace = re.test(c)
                    if (preIsWhitespace && !isWhitespace) {
                        yield i
                    }
                    preIsWhitespace = isWhitespace
                    i++
                }
            }

            /**
             * Check whether the given token is a dummy element.
             * @param {Token} node The token to check.
             * @returns {boolean} `true` if the token is a dummy element.
             */
            function isDummyElement(node) {
                return (
                    !node.startTag &&
                    (node.name === "body" ||
                        node.name === "head" ||
                        node.name === "html")
                )
            }

            /**
             * Get the start token of Element
             * @param  {Node} elementNode The element node
             * @returns {Token} The start token
             */
            function getStartToken(elementNode) {
                if (!elementNode) {
                    return null
                }
                if (elementNode.type !== "HTMLElement") {
                    return null
                }
                if (isDummyElement(elementNode)) {
                    return null
                }
                return elementNode.startTag || elementNode
            }

            microTemplateService.traverseDocumentNodes({
                HTMLElement(node) {
                    if (isDummyElement(node)) {
                        return
                    }
                    const elementNode =
                        microTemplateService.getBranchProcessedHtmlNode(
                            node,
                            sourceCode
                        ) || node
                    const startToken = getStartToken(elementNode)
                    const parentStartToken = getStartToken(elementNode.parent)
                    if (parentStartToken) {
                        // self indent
                        setOffsetToToken(
                            startToken,
                            1,
                            parentStartToken.loc.start.line
                        )
                    } else {
                        setOffsetRootToIndex(startToken.range[0])
                    }
                    if (
                        IGNORE_INDENT_ELEMENT_NAMES.find(
                            name => name === elementNode.name
                        )
                    ) {
                        ignoreRanges.push([
                            elementNode.startTag
                                ? elementNode.startTag.range[1]
                                : elementNode.range[0],
                            elementNode.endTag
                                ? elementNode.endTag.range[0]
                                : elementNode.range[1],
                        ])
                    }
                },
                HTMLStartTag(node) {
                    const attrs = node.attributes.concat(node.ignoredAttributes)
                    setOffsetToToken(
                        attrs,
                        options.attribute,
                        node.loc.start.line
                    )
                    const start = node.tagOpen
                        ? node.tagOpen.range[1]
                        : node.range[0]
                    const end = node.tagClose
                        ? node.tagClose.range[0]
                        : node.range[1]
                    const attrTemplateTokens = microTemplateService
                        .getMicroTemplateTokens()
                        .filter(token => {
                            if (
                                token.range[0] < start ||
                                end < token.range[1]
                            ) {
                                return false
                            }
                            return !attrs.some(
                                n =>
                                    token.range[0] < n.range[1] &&
                                    n.range[0] < token.range[1]
                            )
                        })
                    setOffsetToToken(
                        attrTemplateTokens,
                        options.attribute,
                        node.loc.start.line
                    )

                    if (node.tagClose) {
                        setOffsetToToken(
                            node.tagClose,
                            options.closeBracket,
                            node.loc.start.line
                        )
                    }
                },
                HTMLEndTag(node) {
                    const endTag =
                        microTemplateService.getBranchProcessedHtmlNode(
                            node,
                            sourceCode
                        ) || node
                    const startToken = getStartToken(endTag.parent)
                    if (startToken) {
                        // self indent
                        setOffsetToToken(endTag, 0, startToken.loc.start.line)
                    }

                    if (endTag.tagClose) {
                        setOffsetToToken(
                            endTag.tagClose,
                            options.closeBracket,
                            endTag.loc.start.line
                        )
                    }
                },
                HTMLText(node) {
                    const textNode =
                        microTemplateService.getBranchProcessedHtmlNode(
                            node,
                            sourceCode
                        ) || node

                    const textHTML = sourceCode.text.slice(
                        textNode.range[0],
                        textNode.range[1]
                    )
                    const startToken = getStartToken(textNode.parent)
                    if (startToken) {
                        // self indent
                        for (const i of genWordStartIndices(textHTML)) {
                            setOffsetToIndex(
                                textNode.range[0] + i,
                                1,
                                startToken.loc.start.line
                            )
                        }
                    } else {
                        for (const i of genWordStartIndices(textHTML)) {
                            setOffsetRootToIndex(textNode.range[0] + i)
                        }
                    }
                },
                HTMLComment(node) {
                    const commentNode =
                        microTemplateService.getBranchProcessedHtmlNode(
                            node,
                            sourceCode
                        ) || node
                    const startToken = getStartToken(commentNode.parent)
                    if (startToken) {
                        // self indent
                        setOffsetToToken(
                            commentNode,
                            1,
                            startToken.loc.start.line
                        )
                    } else {
                        setOffsetRootToIndex(commentNode.range[0])
                    }

                    const commentStart = commentNode.range[0] + 4
                    const commentEnd = commentNode.range[1] - 3
                    const comment = sourceCode.text.slice(
                        commentStart,
                        commentEnd
                    )

                    for (const i of genWordStartIndices(comment)) {
                        setOffsetToIndex(
                            commentStart + i,
                            1,
                            commentNode.loc.start.line
                        )
                    }
                    setOffsetToIndex(commentEnd, 0, commentNode.loc.start.line)
                },
            })
        }
1318471
private static function convertHtmlToDom($html)
    {
        $dom = new DOMDocument;

        \libxml_use_internal_errors(true);
        $dom->loadHTML($html);

        \libxml_clear_errors();

        return $dom;
    }
690723
function splitHtml(html, opts, pcex) {
  var _bp = pcex._bp

  // `brackets.split` is a heavy function, so don't call it if not necessary
  if (html && _bp[4].test(html)) {
    var
      jsfn = opts.expr && (opts.parser || opts.type) ? _compileJS : 0,
      list = brackets.split(html, 0, _bp),
      expr

    for (var i = 1; i < list.length; i += 2) {
      expr = list[i]
      if (expr[0] === '^')
        expr = expr.slice(1)
      else if (jsfn) {
        var israw = expr[0] === '='
        expr = jsfn(israw ? expr.slice(1) : expr, opts).trim()
        if (expr.slice(-1) === ';') expr = expr.slice(0, -1)
        if (israw) expr = '=' + expr
      }
      list[i] = '\u0001' + (pcex.push(expr.replace(/[\r\n]+/g, ' ').trim()) - 1) + _bp[1]
    }
    html = list.join('')
  }
  return html
}
817216
function processIssueHtml(element) {
			let outerHTML = null;
			let innerHTML = null;
			if (!element.outerHTML) {
				return outerHTML;
			}
			outerHTML = element.outerHTML;
			if (element.innerHTML.length > 31) {
				innerHTML = `${element.innerHTML.substr(0, 31)}...`;
				outerHTML = outerHTML.replace(element.innerHTML, innerHTML);
			}
			if (outerHTML.length > 251) {
				outerHTML = `${outerHTML.substr(0, 250)}...`;
			}
			return outerHTML;
		}
73373
function fromHTML(html) {
                var div = document.createElement('div');
                div.innerHTML = html;
                return div.childNodes;
            }
587632
function(string) {
  if (!string) {
    var fragment = document.createDocumentFragment();
    fragment.appendChild(document.createTextNode(''));
    return fragment;
  }
  var templateElement;
  templateElement = document.createElement('template');
  templateElement.innerHTML = string;
  return templateElement.content;
}