MCPcopy
hub / github.com/angular-ui/ui-grid / jqLiteBuildFragment

Function jqLiteBuildFragment

lib/test/angular/1.8.0/angular.js:3217–3269  ·  view source on GitHub ↗
(html, context)

Source from the content-addressed store, hash-verified

3215}
3216
3217function jqLiteBuildFragment(html, context) {
3218 var tmp, tag, wrap, finalHtml,
3219 fragment = context.createDocumentFragment(),
3220 nodes = [], i;
3221
3222 if (jqLiteIsTextNode(html)) {
3223 // Convert non-html into a text node
3224 nodes.push(context.createTextNode(html));
3225 } else {
3226 // Convert html into DOM nodes
3227 tmp = fragment.appendChild(context.createElement('div'));
3228 tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase();
3229 finalHtml = JQLite.legacyXHTMLReplacement ?
3230 html.replace(XHTML_TAG_REGEXP, '<$1></$2>') :
3231 html;
3232
3233 if (msie < 10) {
3234 wrap = wrapMapIE9[tag] || wrapMapIE9._default;
3235 tmp.innerHTML = wrap[1] + finalHtml + wrap[2];
3236
3237 // Descend through wrappers to the right content
3238 i = wrap[0];
3239 while (i--) {
3240 tmp = tmp.firstChild;
3241 }
3242 } else {
3243 wrap = wrapMap[tag] || [];
3244
3245 // Create wrappers & descend into them
3246 i = wrap.length;
3247 while (--i > -1) {
3248 tmp.appendChild(window.document.createElement(wrap[i]));
3249 tmp = tmp.firstChild;
3250 }
3251
3252 tmp.innerHTML = finalHtml;
3253 }
3254
3255 nodes = concat(nodes, tmp.childNodes);
3256
3257 tmp = fragment.firstChild;
3258 tmp.textContent = '';
3259 }
3260
3261 // Remove wrapper from fragment
3262 fragment.textContent = '';
3263 fragment.innerHTML = ''; // Clear inner HTML
3264 forEach(nodes, function(node) {
3265 fragment.appendChild(node);
3266 });
3267
3268 return fragment;
3269}
3270
3271function jqLiteParseHTML(html, context) {
3272 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