MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / jqLiteBuildFragment

Function jqLiteBuildFragment

lib/test/angular/1.4.3/angular.js:2688–2723  ·  view source on GitHub ↗
(html, context)

Source from the content-addressed store, hash-verified

2686}
2687
2688function jqLiteBuildFragment(html, context) {
2689 var tmp, tag, wrap,
2690 fragment = context.createDocumentFragment(),
2691 nodes = [], i;
2692
2693 if (jqLiteIsTextNode(html)) {
2694 // Convert non-html into a text node
2695 nodes.push(context.createTextNode(html));
2696 } else {
2697 // Convert html into DOM nodes
2698 tmp = tmp || fragment.appendChild(context.createElement("div"));
2699 tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
2700 wrap = wrapMap[tag] || wrapMap._default;
2701 tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
2702
2703 // Descend through wrappers to the right content
2704 i = wrap[0];
2705 while (i--) {
2706 tmp = tmp.lastChild;
2707 }
2708
2709 nodes = concat(nodes, tmp.childNodes);
2710
2711 tmp = fragment.firstChild;
2712 tmp.textContent = "";
2713 }
2714
2715 // Remove wrapper from fragment
2716 fragment.textContent = "";
2717 fragment.innerHTML = ""; // Clear inner HTML
2718 forEach(nodes, function(node) {
2719 fragment.appendChild(node);
2720 });
2721
2722 return fragment;
2723}
2724
2725function jqLiteParseHTML(html, context) {
2726 context = context || document;

Callers 2

jqLiteParseHTMLFunction · 0.70
angular.jsFile · 0.70

Calls 3

jqLiteIsTextNodeFunction · 0.70
concatFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected