(html, context)
| 3121 | } |
| 3122 | |
| 3123 | function jqLiteBuildFragment(html, context) { |
| 3124 | var tmp, tag, wrap, |
| 3125 | fragment = context.createDocumentFragment(), |
| 3126 | nodes = [], i; |
| 3127 | |
| 3128 | if (jqLiteIsTextNode(html)) { |
| 3129 | // Convert non-html into a text node |
| 3130 | nodes.push(context.createTextNode(html)); |
| 3131 | } else { |
| 3132 | // Convert html into DOM nodes |
| 3133 | tmp = fragment.appendChild(context.createElement('div')); |
| 3134 | tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase(); |
| 3135 | wrap = wrapMap[tag] || wrapMap._default; |
| 3136 | tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2]; |
| 3137 | |
| 3138 | // Descend through wrappers to the right content |
| 3139 | i = wrap[0]; |
| 3140 | while (i--) { |
| 3141 | tmp = tmp.lastChild; |
| 3142 | } |
| 3143 | |
| 3144 | nodes = concat(nodes, tmp.childNodes); |
| 3145 | |
| 3146 | tmp = fragment.firstChild; |
| 3147 | tmp.textContent = ''; |
| 3148 | } |
| 3149 | |
| 3150 | // Remove wrapper from fragment |
| 3151 | fragment.textContent = ''; |
| 3152 | fragment.innerHTML = ''; // Clear inner HTML |
| 3153 | forEach(nodes, function(node) { |
| 3154 | fragment.appendChild(node); |
| 3155 | }); |
| 3156 | |
| 3157 | return fragment; |
| 3158 | } |
| 3159 | |
| 3160 | function jqLiteParseHTML(html, context) { |
| 3161 | context = context || window.document; |
no test coverage detected