MCPcopy Create free account
hub / github.com/angular-ui/ui-grid / jqLiteBuildFragment

Function jqLiteBuildFragment

lib/test/angular/1.6.7/angular.js:3147–3182  ·  view source on GitHub ↗
(html, context)

Source from the content-addressed store, hash-verified

3145}
3146
3147function jqLiteBuildFragment(html, context) {
3148 var tmp, tag, wrap,
3149 fragment = context.createDocumentFragment(),
3150 nodes = [], i;
3151
3152 if (jqLiteIsTextNode(html)) {
3153 // Convert non-html into a text node
3154 nodes.push(context.createTextNode(html));
3155 } else {
3156 // Convert html into DOM nodes
3157 tmp = fragment.appendChild(context.createElement('div'));
3158 tag = (TAG_NAME_REGEXP.exec(html) || ['', ''])[1].toLowerCase();
3159 wrap = wrapMap[tag] || wrapMap._default;
3160 tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, '<$1></$2>') + wrap[2];
3161
3162 // Descend through wrappers to the right content
3163 i = wrap[0];
3164 while (i--) {
3165 tmp = tmp.lastChild;
3166 }
3167
3168 nodes = concat(nodes, tmp.childNodes);
3169
3170 tmp = fragment.firstChild;
3171 tmp.textContent = '';
3172 }
3173
3174 // Remove wrapper from fragment
3175 fragment.textContent = '';
3176 fragment.innerHTML = ''; // Clear inner HTML
3177 forEach(nodes, function(node) {
3178 fragment.appendChild(node);
3179 });
3180
3181 return fragment;
3182}
3183
3184function jqLiteParseHTML(html, context) {
3185 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