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

Function jqLiteBuildFragment

test/angular/1.2/angular.js:2321–2354  ·  view source on GitHub ↗
(html, context)

Source from the content-addressed store, hash-verified

2319}
2320
2321function jqLiteBuildFragment(html, context) {
2322 var elem, tmp, tag, wrap,
2323 fragment = context.createDocumentFragment(),
2324 nodes = [], i, j, jj;
2325
2326 if (jqLiteIsTextNode(html)) {
2327 // Convert non-html into a text node
2328 nodes.push(context.createTextNode(html));
2329 } else {
2330 tmp = fragment.appendChild(context.createElement('div'));
2331 // Convert html into DOM nodes
2332 tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
2333 wrap = wrapMap[tag] || wrapMap._default;
2334 tmp.innerHTML = '<div>&#160;</div>' +
2335 wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
2336 tmp.removeChild(tmp.firstChild);
2337
2338 // Descend through wrappers to the right content
2339 i = wrap[0];
2340 while (i--) {
2341 tmp = tmp.lastChild;
2342 }
2343
2344 for (j=0, jj=tmp.childNodes.length; j<jj; ++j) nodes.push(tmp.childNodes[j]);
2345
2346 tmp = fragment.firstChild;
2347 tmp.textContent = "";
2348 }
2349
2350 // Remove wrapper from fragment
2351 fragment.textContent = "";
2352 fragment.innerHTML = ""; // Clear inner HTML
2353 return nodes;
2354}
2355
2356function jqLiteParseHTML(html, context) {
2357 context = context || document;

Callers 1

jqLiteParseHTMLFunction · 0.70

Calls 1

jqLiteIsTextNodeFunction · 0.70

Tested by

no test coverage detected