MCPcopy Index your code
hub / github.com/angular-ui/ui-grid / addOrReuseElement

Function addOrReuseElement

lib/test/angular/1.4.3/angular.js:26310–26328  ·  view source on GitHub ↗
(parent, current, type, templateElement)

Source from the content-addressed store, hash-verified

26308 }
26309
26310 function addOrReuseElement(parent, current, type, templateElement) {
26311 var element;
26312 // Check whether we can reuse the next element
26313 if (current && lowercase(current.nodeName) === type) {
26314 // The next element is the right type so reuse it
26315 element = current;
26316 } else {
26317 // The next element is not the right type so create a new one
26318 element = templateElement.cloneNode(false);
26319 if (!current) {
26320 // There are no more elements so just append it to the select
26321 parent.appendChild(element);
26322 } else {
26323 // The next element is not a group so insert the new one
26324 parent.insertBefore(element, current);
26325 }
26326 }
26327 return element;
26328 }
26329
26330
26331 function removeExcessElements(current) {

Callers 1

updateOptionsFunction · 0.70

Calls 1

lowercaseFunction · 0.70

Tested by

no test coverage detected