(html, context)
| 2463 | } |
| 2464 | |
| 2465 | function jqLiteBuildFragment(html, context) { |
| 2466 | var tmp, tag, wrap, |
| 2467 | fragment = context.createDocumentFragment(), |
| 2468 | nodes = [], i; |
| 2469 | |
| 2470 | if (jqLiteIsTextNode(html)) { |
| 2471 | // Convert non-html into a text node |
| 2472 | nodes.push(context.createTextNode(html)); |
| 2473 | } else { |
| 2474 | // Convert html into DOM nodes |
| 2475 | tmp = tmp || fragment.appendChild(context.createElement("div")); |
| 2476 | tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase(); |
| 2477 | wrap = wrapMap[tag] || wrapMap._default; |
| 2478 | tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2]; |
| 2479 | |
| 2480 | // Descend through wrappers to the right content |
| 2481 | i = wrap[0]; |
| 2482 | while (i--) { |
| 2483 | tmp = tmp.lastChild; |
| 2484 | } |
| 2485 | |
| 2486 | nodes = concat(nodes, tmp.childNodes); |
| 2487 | |
| 2488 | tmp = fragment.firstChild; |
| 2489 | tmp.textContent = ""; |
| 2490 | } |
| 2491 | |
| 2492 | // Remove wrapper from fragment |
| 2493 | fragment.textContent = ""; |
| 2494 | fragment.innerHTML = ""; // Clear inner HTML |
| 2495 | forEach(nodes, function(node) { |
| 2496 | fragment.appendChild(node); |
| 2497 | }); |
| 2498 | |
| 2499 | return fragment; |
| 2500 | } |
| 2501 | |
| 2502 | function jqLiteParseHTML(html, context) { |
| 2503 | context = context || document; |
no test coverage detected