MCPcopy Index your code
hub / github.com/angular-ui/ui-router / jqLiteBuildFragment

Function jqLiteBuildFragment

test/angular/1.6/angular.js:3164–3199  ·  view source on GitHub ↗
(html, context)

Source from the content-addressed store, hash-verified

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

Callers 2

jqLiteParseHTMLFunction · 0.70
angular.jsFile · 0.70

Calls 3

jqLiteIsTextNodeFunction · 0.70
concatFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected