MCPcopy Index your code
hub / github.com/angular-ui/ui-router / jqLiteBuildFragment

Function jqLiteBuildFragment

test/angular/1.5/angular.js:2926–2961  ·  view source on GitHub ↗
(html, context)

Source from the content-addressed store, hash-verified

2924}
2925
2926function jqLiteBuildFragment(html, context) {
2927 var tmp, tag, wrap,
2928 fragment = context.createDocumentFragment(),
2929 nodes = [], i;
2930
2931 if (jqLiteIsTextNode(html)) {
2932 // Convert non-html into a text node
2933 nodes.push(context.createTextNode(html));
2934 } else {
2935 // Convert html into DOM nodes
2936 tmp = fragment.appendChild(context.createElement('div'));
2937 tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase();
2938 wrap = wrapMap[tag] || wrapMap._default;
2939 tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2];
2940
2941 // Descend through wrappers to the right content
2942 i = wrap[0];
2943 while (i--) {
2944 tmp = tmp.lastChild;
2945 }
2946
2947 nodes = concat(nodes, tmp.childNodes);
2948
2949 tmp = fragment.firstChild;
2950 tmp.textContent = '';
2951 }
2952
2953 // Remove wrapper from fragment
2954 fragment.textContent = '';
2955 fragment.innerHTML = ''; // Clear inner HTML
2956 forEach(nodes, function(node) {
2957 fragment.appendChild(node);
2958 });
2959
2960 return fragment;
2961}
2962
2963function jqLiteParseHTML(html, context) {
2964 context = context || window.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