(html, context)
| 2774 | } |
| 2775 | |
| 2776 | function jqLiteBuildFragment(html, context) { |
| 2777 | var tmp, tag, wrap, |
| 2778 | fragment = context.createDocumentFragment(), |
| 2779 | nodes = [], i; |
| 2780 | |
| 2781 | if (jqLiteIsTextNode(html)) { |
| 2782 | // Convert non-html into a text node |
| 2783 | nodes.push(context.createTextNode(html)); |
| 2784 | } else { |
| 2785 | // Convert html into DOM nodes |
| 2786 | tmp = tmp || fragment.appendChild(context.createElement("div")); |
| 2787 | tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase(); |
| 2788 | wrap = wrapMap[tag] || wrapMap._default; |
| 2789 | tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2]; |
| 2790 | |
| 2791 | // Descend through wrappers to the right content |
| 2792 | i = wrap[0]; |
| 2793 | while (i--) { |
| 2794 | tmp = tmp.lastChild; |
| 2795 | } |
| 2796 | |
| 2797 | nodes = concat(nodes, tmp.childNodes); |
| 2798 | |
| 2799 | tmp = fragment.firstChild; |
| 2800 | tmp.textContent = ""; |
| 2801 | } |
| 2802 | |
| 2803 | // Remove wrapper from fragment |
| 2804 | fragment.textContent = ""; |
| 2805 | fragment.innerHTML = ""; // Clear inner HTML |
| 2806 | forEach(nodes, function(node) { |
| 2807 | fragment.appendChild(node); |
| 2808 | }); |
| 2809 | |
| 2810 | return fragment; |
| 2811 | } |
| 2812 | |
| 2813 | function jqLiteParseHTML(html, context) { |
| 2814 | context = context || document; |
no test coverage detected