(html, context)
| 3167 | } |
| 3168 | |
| 3169 | function jqLiteBuildFragment(html, context) { |
| 3170 | var tmp, tag, wrap, |
| 3171 | fragment = context.createDocumentFragment(), |
| 3172 | nodes = [], i; |
| 3173 | |
| 3174 | if (jqLiteIsTextNode(html)) { |
| 3175 | // Convert non-html into a text node |
| 3176 | nodes.push(context.createTextNode(html)); |
| 3177 | } else { |
| 3178 | // Convert html into DOM nodes |
| 3179 | tmp = fragment.appendChild(context.createElement('div')); |
| 3180 | tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase(); |
| 3181 | wrap = wrapMap[tag] || wrapMap._default; |
| 3182 | tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2]; |
| 3183 | |
| 3184 | // Descend through wrappers to the right content |
| 3185 | i = wrap[0]; |
| 3186 | while (i--) { |
| 3187 | tmp = tmp.lastChild; |
| 3188 | } |
| 3189 | |
| 3190 | nodes = concat(nodes, tmp.childNodes); |
| 3191 | |
| 3192 | tmp = fragment.firstChild; |
| 3193 | tmp.textContent = ''; |
| 3194 | } |
| 3195 | |
| 3196 | // Remove wrapper from fragment |
| 3197 | fragment.textContent = ''; |
| 3198 | fragment.innerHTML = ''; // Clear inner HTML |
| 3199 | forEach(nodes, function(node) { |
| 3200 | fragment.appendChild(node); |
| 3201 | }); |
| 3202 | |
| 3203 | return fragment; |
| 3204 | } |
| 3205 | |
| 3206 | function jqLiteParseHTML(html, context) { |
| 3207 | context = context || window.document; |
no test coverage detected