(html, context)
| 2418 | } |
| 2419 | |
| 2420 | function jqLiteBuildFragment(html, context) { |
| 2421 | var tmp, tag, wrap, |
| 2422 | fragment = context.createDocumentFragment(), |
| 2423 | nodes = [], i; |
| 2424 | |
| 2425 | if (jqLiteIsTextNode(html)) { |
| 2426 | // Convert non-html into a text node |
| 2427 | nodes.push(context.createTextNode(html)); |
| 2428 | } else { |
| 2429 | // Convert html into DOM nodes |
| 2430 | tmp = tmp || fragment.appendChild(context.createElement("div")); |
| 2431 | tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase(); |
| 2432 | wrap = wrapMap[tag] || wrapMap._default; |
| 2433 | tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2]; |
| 2434 | |
| 2435 | // Descend through wrappers to the right content |
| 2436 | i = wrap[0]; |
| 2437 | while (i--) { |
| 2438 | tmp = tmp.lastChild; |
| 2439 | } |
| 2440 | |
| 2441 | nodes = concat(nodes, tmp.childNodes); |
| 2442 | |
| 2443 | tmp = fragment.firstChild; |
| 2444 | tmp.textContent = ""; |
| 2445 | } |
| 2446 | |
| 2447 | // Remove wrapper from fragment |
| 2448 | fragment.textContent = ""; |
| 2449 | fragment.innerHTML = ""; // Clear inner HTML |
| 2450 | forEach(nodes, function(node) { |
| 2451 | fragment.appendChild(node); |
| 2452 | }); |
| 2453 | |
| 2454 | return fragment; |
| 2455 | } |
| 2456 | |
| 2457 | function jqLiteParseHTML(html, context) { |
| 2458 | context = context || document; |
no test coverage detected