(html, context)
| 2924 | } |
| 2925 | |
| 2926 | function 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 | |
| 2963 | function jqLiteParseHTML(html, context) { |
| 2964 | context = context || window.document; |
no test coverage detected